├── smartcontractClient ├── smartcontracts │ ├── IoT │ │ └── IoTOracelContract.sol │ └── simple-contracts │ │ └── SimpleContract.sol ├── readme.md └── nodeapp │ ├── package.json │ ├── simplecontractapp.js │ └── smartContractClient.js ├── document-sign-demo ├── node_modules │ ├── xhr2 │ │ ├── test │ │ │ ├── fixtures │ │ │ │ ├── hello.txt │ │ │ │ ├── hello.json │ │ │ │ └── xhr2.png │ │ │ ├── src │ │ │ │ ├── helpers │ │ │ │ │ ├── browser_mocha_setup.coffee │ │ │ │ │ ├── browser_mocha_runner.coffee │ │ │ │ │ └── setup.coffee │ │ │ │ ├── responseurl_test.coffee │ │ │ │ ├── status_test.coffee │ │ │ │ ├── redirect_test.coffee │ │ │ │ └── event_target_test.coffee │ │ │ └── html │ │ │ │ └── browser_test.html │ │ ├── lib │ │ │ └── browser.js │ │ ├── .npmignore │ │ ├── src │ │ │ ├── errors.coffee │ │ │ └── progress_event.coffee │ │ ├── LICENSE.txt │ │ ├── CONTRIBUTING.md │ │ └── package.json │ ├── web3 │ │ ├── lib │ │ │ ├── version.json │ │ │ ├── utils │ │ │ │ ├── browser-bn.js │ │ │ │ ├── browser-xhr.js │ │ │ │ ├── sha3.js │ │ │ │ └── config.js │ │ │ ├── web3 │ │ │ │ ├── settings.js │ │ │ │ ├── namereg.js │ │ │ │ ├── extend.js │ │ │ │ ├── methods │ │ │ │ │ ├── net.js │ │ │ │ │ └── db.js │ │ │ │ ├── errors.js │ │ │ │ ├── batch.js │ │ │ │ ├── jsonrpc.js │ │ │ │ └── transfer.js │ │ │ ├── solidity │ │ │ │ ├── string.js │ │ │ │ ├── dynamicbytes.js │ │ │ │ ├── bool.js │ │ │ │ ├── address.js │ │ │ │ ├── bytes.js │ │ │ │ ├── int.js │ │ │ │ ├── real.js │ │ │ │ ├── uint.js │ │ │ │ └── ureal.js │ │ │ └── contracts │ │ │ │ └── ICAPRegistrar.json │ │ ├── circle.yml │ │ ├── .versions │ │ ├── .bowerrc │ │ ├── coverage │ │ │ ├── sort-arrow-sprite.png │ │ │ ├── lcov-report │ │ │ │ ├── sort-arrow-sprite.png │ │ │ │ └── prettify.css │ │ │ └── prettify.css │ │ ├── node_modules │ │ │ └── bignumber.js │ │ │ │ ├── .travis.yml │ │ │ │ ├── bower.json │ │ │ │ ├── LICENCE │ │ │ │ └── package.json │ │ ├── .idea │ │ │ ├── watcherTasks.xml │ │ │ ├── misc.xml │ │ │ ├── vcs.xml │ │ │ ├── dictionaries │ │ │ │ └── frozeman.xml │ │ │ ├── jsLibraryMappings.xml │ │ │ ├── inspectionProfiles │ │ │ │ ├── profiles_settings.xml │ │ │ │ └── Project_Default.xml │ │ │ ├── modules.xml │ │ │ ├── web3.iml │ │ │ └── jsLinters │ │ │ │ └── jshint.xml │ │ ├── bower │ │ │ ├── bignumber.js │ │ │ │ ├── perf │ │ │ │ │ ├── lib │ │ │ │ │ │ └── bigdecimal_GWT │ │ │ │ │ │ │ ├── BigDecTest.class │ │ │ │ │ │ │ ├── bugs.js │ │ │ │ │ │ │ └── BigDecTest.java │ │ │ │ │ └── README.md │ │ │ │ ├── bower.json │ │ │ │ ├── .bower.json │ │ │ │ └── LICENCE │ │ │ └── crypto-js │ │ │ │ ├── enc-hex.js │ │ │ │ ├── enc-utf8.js │ │ │ │ ├── enc-latin1.js │ │ │ │ ├── pad-pkcs7.js │ │ │ │ ├── format-openssl.js │ │ │ │ ├── hmac-md5.js │ │ │ │ ├── hmac-sha1.js │ │ │ │ ├── hmac-sha256.js │ │ │ │ ├── hmac-ripemd160.js │ │ │ │ ├── hmac-sha3.js │ │ │ │ ├── hmac-sha224.js │ │ │ │ ├── hmac-sha512.js │ │ │ │ ├── hmac-sha384.js │ │ │ │ ├── CONTRIBUTING.md │ │ │ │ ├── pad-nopadding.js │ │ │ │ ├── bower.json │ │ │ │ ├── package.json │ │ │ │ ├── .bower.json │ │ │ │ ├── mode-ecb.js │ │ │ │ ├── pad-iso97971.js │ │ │ │ ├── pad-zeropadding.js │ │ │ │ ├── LICENSE │ │ │ │ ├── pad-iso10126.js │ │ │ │ ├── pad-ansix923.js │ │ │ │ ├── mode-ofb.js │ │ │ │ ├── index.js │ │ │ │ ├── mode-ctr.js │ │ │ │ ├── format-hex.js │ │ │ │ ├── sha224.js │ │ │ │ ├── mode-cfb.js │ │ │ │ ├── lib-typedarrays.js │ │ │ │ ├── sha384.js │ │ │ │ └── mode-ctr-gladman.js │ │ ├── index.js │ │ ├── example │ │ │ ├── node-app.js │ │ │ ├── balance.html │ │ │ ├── contract.html │ │ │ └── contract_array.html │ │ ├── .jshintrc │ │ ├── package-init.js │ │ ├── LICENSE │ │ ├── package.js │ │ ├── bower.json │ │ └── packages │ │ │ └── web3-providers-ws │ │ │ └── package-lock.json │ ├── xmlhttprequest │ │ ├── .npmignore │ │ ├── .jshintrc │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── crypto-js │ │ ├── enc-hex.js │ │ ├── enc-latin1.js │ │ ├── enc-utf8.js │ │ ├── pad-pkcs7.js │ │ ├── format-openssl.js │ │ ├── hmac-md5.js │ │ ├── hmac-sha1.js │ │ ├── hmac-sha256.js │ │ ├── hmac-ripemd160.js │ │ ├── hmac-sha3.js │ │ ├── hmac-sha224.js │ │ ├── hmac-sha512.js │ │ ├── hmac-sha384.js │ │ ├── CONTRIBUTING.md │ │ ├── pad-nopadding.js │ │ ├── bower.json │ │ ├── mode-ecb.js │ │ ├── pad-iso97971.js │ │ ├── pad-zeropadding.js │ │ ├── LICENSE │ │ ├── pad-iso10126.js │ │ ├── pad-ansix923.js │ │ ├── mode-ofb.js │ │ ├── index.js │ │ ├── mode-ctr.js │ │ ├── package.json │ │ ├── format-hex.js │ │ ├── sha224.js │ │ ├── mode-cfb.js │ │ ├── lib-typedarrays.js │ │ ├── sha384.js │ │ └── mode-ctr-gladman.js │ └── utf8 │ │ ├── LICENSE-MIT.txt │ │ └── package.json ├── media │ └── 1979002fadc27fa45feb6c8dd7036498.png ├── package.json ├── truffle │ └── 2_deploy.js ├── README.md ├── package-lock.json ├── smartcontracts │ ├── Vessel.sol │ ├── TonnageCert.sol │ └── ClassCert.sol ├── test-truffle-builder.js ├── test-truffle-vessel.js ├── test-truffle-class.js └── test-truffle-tonnage.js ├── README.md └── oracle ├── media ├── 1311fe605df00a930a024c270b15dc82.png ├── 1b0438a3b1216ae7c2e5576c09de2a56.png ├── 21260768a717b351777f8758b5f8e64d.png ├── 3efcbb5f10616e3487ed3925082b94f7.png ├── 57a72589b66523fc38ab1c3160dbe283.png ├── 6dd322c2de857b3a1389f206a8881149.png ├── 96fcb3fdebcf6bce4c5fb15371c67554.png ├── a269571473d9993f84e324c429e653f1.png └── def2f0da2c83ef06347532a7005f9110.png ├── nodeapp ├── package.json ├── convertToChecksum.js └── oracleListener.js └── smartcontracts ├── OracleResolver4.sol ├── OracleContract4.sol └── OracleApp4.sol /smartcontractClient/smartcontracts/IoT/IoTOracelContract.sol: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/test/fixtures/hello.txt: -------------------------------------------------------------------------------- 1 | Hello world! 2 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/lib/browser.js: -------------------------------------------------------------------------------- 1 | module.exports = XMLHttpRequest; 2 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/version.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.20.4" 3 | } 4 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/test/fixtures/hello.json: -------------------------------------------------------------------------------- 1 | {"hello": "world", "answer": 42} 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # My Blockchain Learnings # 2 | I am posting my Blockchain learning in this repository 3 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/circle.yml: -------------------------------------------------------------------------------- 1 | test: 2 | override: 3 | - npm run test && npm run lint -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xmlhttprequest/.npmignore: -------------------------------------------------------------------------------- 1 | example 2 | tests 3 | 4 | autotest.watchr 5 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/.versions: -------------------------------------------------------------------------------- 1 | ethereum:web3@0.20.2 2 | meteor@1.7.0 3 | underscore@1.0.10 4 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "bower", 3 | "cwd": "./", 4 | "analytics": false 5 | } 6 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/utils/browser-bn.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = BigNumber; // jshint ignore:line 4 | 5 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/test/src/helpers/browser_mocha_setup.coffee: -------------------------------------------------------------------------------- 1 | mocha.setup ui: 'bdd', slow: 150, timeout: 1000, bail: false 2 | -------------------------------------------------------------------------------- /oracle/media/1311fe605df00a930a024c270b15dc82.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/blockchain-learning/master/oracle/media/1311fe605df00a930a024c270b15dc82.png -------------------------------------------------------------------------------- /oracle/media/1b0438a3b1216ae7c2e5576c09de2a56.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/blockchain-learning/master/oracle/media/1b0438a3b1216ae7c2e5576c09de2a56.png -------------------------------------------------------------------------------- /oracle/media/21260768a717b351777f8758b5f8e64d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/blockchain-learning/master/oracle/media/21260768a717b351777f8758b5f8e64d.png -------------------------------------------------------------------------------- /oracle/media/3efcbb5f10616e3487ed3925082b94f7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/blockchain-learning/master/oracle/media/3efcbb5f10616e3487ed3925082b94f7.png -------------------------------------------------------------------------------- /oracle/media/57a72589b66523fc38ab1c3160dbe283.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/blockchain-learning/master/oracle/media/57a72589b66523fc38ab1c3160dbe283.png -------------------------------------------------------------------------------- /oracle/media/6dd322c2de857b3a1389f206a8881149.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/blockchain-learning/master/oracle/media/6dd322c2de857b3a1389f206a8881149.png -------------------------------------------------------------------------------- /oracle/media/96fcb3fdebcf6bce4c5fb15371c67554.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/blockchain-learning/master/oracle/media/96fcb3fdebcf6bce4c5fb15371c67554.png -------------------------------------------------------------------------------- /oracle/media/a269571473d9993f84e324c429e653f1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/blockchain-learning/master/oracle/media/a269571473d9993f84e324c429e653f1.png -------------------------------------------------------------------------------- /oracle/media/def2f0da2c83ef06347532a7005f9110.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/blockchain-learning/master/oracle/media/def2f0da2c83ef06347532a7005f9110.png -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/test/fixtures/xhr2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/blockchain-learning/master/document-sign-demo/node_modules/xhr2/test/fixtures/xhr2.png -------------------------------------------------------------------------------- /document-sign-demo/media/1979002fadc27fa45feb6c8dd7036498.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/blockchain-learning/master/document-sign-demo/media/1979002fadc27fa45feb6c8dd7036498.png -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/coverage/sort-arrow-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/blockchain-learning/master/document-sign-demo/node_modules/web3/coverage/sort-arrow-sprite.png -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/node_modules/bignumber.js/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.12" 4 | - "0.11" 5 | - "0.10" 6 | - "0.8" 7 | - "0.6" 8 | - iojs 9 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/.idea/watcherTasks.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/coverage/lcov-report/sort-arrow-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/blockchain-learning/master/document-sign-demo/node_modules/web3/coverage/lcov-report/sort-arrow-sprite.png -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/web3/settings.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | var Settings = function () { 4 | this.defaultBlock = 'latest'; 5 | this.defaultAccount = undefined; 6 | }; 7 | 8 | module.exports = Settings; 9 | 10 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/bignumber.js/perf/lib/bigdecimal_GWT/BigDecTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/blockchain-learning/master/document-sign-demo/node_modules/web3/bower/bignumber.js/perf/lib/bigdecimal_GWT/BigDecTest.class -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/.idea/dictionaries/frozeman.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ethereum 5 | vogelsteller 6 | 7 | 8 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/index.js: -------------------------------------------------------------------------------- 1 | var Web3 = require('./lib/web3'); 2 | 3 | // dont override global variable 4 | if (typeof window !== 'undefined' && typeof window.Web3 === 'undefined') { 5 | window.Web3 = Web3; 6 | } 7 | 8 | module.exports = Web3; 9 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/.idea/jsLibraryMappings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /document-sign-demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mpa-hackfest", 3 | "namespace": "mpa-hackfest", 4 | "version": "0.20.4", 5 | "description": "DEMO for MPA Blockchain hackfest", 6 | "dependencies": { 7 | "web3": "^0.20.0" 8 | }, 9 | "license": "LGPL-3.0" 10 | } 11 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/utils/browser-xhr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // go env doesn't have and need XMLHttpRequest 4 | if (typeof XMLHttpRequest === 'undefined') { 5 | exports.XMLHttpRequest = {}; 6 | } else { 7 | exports.XMLHttpRequest = XMLHttpRequest; // jshint ignore:line 8 | } 9 | 10 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /oracle/nodeapp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "oracle-demo", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "web3": "^0.19.0" 13 | } 14 | } -------------------------------------------------------------------------------- /smartcontractClient/smartcontracts/simple-contracts/SimpleContract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.2; 2 | 3 | contract SimpleContract { 4 | address owner; 5 | uint public exchangeRate; 6 | function SimpleContract() { 7 | owner = msg.sender; 8 | } 9 | function UpdateExchangeRate(uint newRate) { 10 | exchangeRate = newRate; 11 | } 12 | } -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/example/node-app.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var Web3 = require('../index.js'); 4 | var web3 = new Web3(); 5 | 6 | web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545')); 7 | 8 | var coinbase = web3.eth.coinbase; 9 | console.log(coinbase); 10 | 11 | var balance = web3.eth.getBalance(coinbase); 12 | console.log(balance.toString(10)); 13 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/test/src/helpers/browser_mocha_runner.coffee: -------------------------------------------------------------------------------- 1 | window.addEventListener 'load', -> 2 | runner = null 3 | runner = mocha.run -> 4 | return if runner is null # Synchronous tests may call this spuriously. 5 | failures = runner.failures || 0 6 | total = runner.total || 0 7 | image = new Image() 8 | image.src = "/diediedie?failed=#{failures}&total=#{total}"; 9 | image.onload = -> 10 | null 11 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/enc-hex.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.enc.Hex; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/enc-latin1.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.enc.Latin1; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/enc-utf8.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.enc.Utf8; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/enc-hex.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.enc.Hex; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/enc-utf8.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.enc.Utf8; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/enc-latin1.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.enc.Latin1; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "browserify": true, 3 | "bitwise": true, 4 | "camelcase": true, 5 | "eqeqeq": true, 6 | "freeze": true, 7 | "funcscope": false, 8 | "maxcomplexity": 5, /* our target is 3! */ 9 | "maxdepth": 3, 10 | "maxerr": 50, 11 | /*"maxlen": 80*/ /*this should be our goal*/ 12 | /*"maxparams": 3,*/ 13 | "nonew": true, 14 | "unused": true, 15 | "undef": true, 16 | "predef": [ 17 | "console" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/.npmignore: -------------------------------------------------------------------------------- 1 | # Vim. 2 | *.swp 3 | .vimrc 4 | 5 | # OSX 6 | .DS_Store 7 | 8 | # Git. 9 | .git 10 | 11 | # Travis. 12 | .travis.yml 13 | 14 | # Npm modules. 15 | node_modules 16 | 17 | # Vendored javascript modules. 18 | test/vendor 19 | 20 | # Test build output. 21 | test/js 22 | tmp/*.js 23 | 24 | # Documentation output. 25 | doc/*.html 26 | doc/assets 27 | doc/classes 28 | doc/files 29 | 30 | # Potentially sensitive credentials and keys used during testing. 31 | test/ssl 32 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/pad-pkcs7.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.pad.Pkcs7; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/format-openssl.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.format.OpenSSL; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/hmac-md5.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./md5"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./md5", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacMD5; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/pad-pkcs7.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.pad.Pkcs7; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/hmac-sha1.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./sha1", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacSHA1; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/hmac-sha256.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./sha256"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./sha256", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacSHA256; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/format-openssl.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.format.OpenSSL; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/hmac-md5.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./md5"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./md5", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacMD5; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/hmac-sha1.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./sha1", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacSHA1; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/hmac-ripemd160.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./ripemd160"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./ripemd160", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacRIPEMD160; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/hmac-sha256.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./sha256"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./sha256", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacSHA256; 17 | 18 | })); -------------------------------------------------------------------------------- /oracle/smartcontracts/OracleResolver4.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.10; 2 | 3 | contract OracleResolver4 { 4 | address owner; 5 | address public oracleAddress; 6 | 7 | function OracleResolver4() { 8 | owner = msg.sender; 9 | } 10 | 11 | modifier onwerOnly { 12 | require(msg.sender == owner); 13 | _; 14 | } 15 | 16 | function setOracleAddress(address addr) { 17 | oracleAddress = addr; 18 | } 19 | 20 | function getOracleAddress() constant returns (address) { 21 | return oracleAddress; 22 | } 23 | } -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/hmac-ripemd160.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./ripemd160"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./ripemd160", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacRIPEMD160; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/hmac-sha3.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha3"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./x64-core", "./sha3", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacSHA3; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/hmac-sha224.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./sha256"), require("./sha224"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./sha256", "./sha224", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacSHA224; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/hmac-sha512.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./x64-core", "./sha512", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacSHA512; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/hmac-sha3.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha3"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./x64-core", "./sha3", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacSHA3; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/hmac-sha224.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./sha256"), require("./sha224"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./sha256", "./sha224", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacSHA224; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/truffle/2_deploy.js: -------------------------------------------------------------------------------- 1 | var builder = artifacts.require("./contracts/BuilderCert.sol"); 2 | var cc = artifacts.require("./contracts/ClassCert.sol"); 3 | var tonnage = artifacts.require("./contracts/TonnageCert.sol"); 4 | var vessel = artifacts.require("./contracts/Vessel.sol"); 5 | 6 | module.exports = function(deployer) { 7 | deployer.deploy(cc).then(function(){ 8 | deployer.deploy(builder).then(function(){ 9 | deployer.deploy(tonnage).then(function(){ 10 | deployer.deploy(vessel); 11 | }); 12 | }); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/hmac-sha512.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./x64-core", "./sha512", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacSHA512; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xmlhttprequest/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "browser": false, 4 | "esnext": true, 5 | "bitwise": false, 6 | "camelcase": true, 7 | "curly": true, 8 | "eqeqeq": true, 9 | "eqnull": true, 10 | "immed": true, 11 | "indent": 2, 12 | "latedef": true, 13 | "laxbreak": true, 14 | "newcap": true, 15 | "noarg": true, 16 | "quotmark": "double", 17 | "regexp": true, 18 | "undef": true, 19 | "unused": true, 20 | "strict": true, 21 | "trailing": true, 22 | "smarttabs": true, 23 | "globals": { 24 | "define": false 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/.idea/web3.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/hmac-sha384.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"), require("./sha384"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./x64-core", "./sha512", "./sha384", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacSHA384; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/hmac-sha384.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"), require("./sha384"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./x64-core", "./sha512", "./sha384", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacSHA384; 17 | 18 | })); -------------------------------------------------------------------------------- /oracle/nodeapp/convertToChecksum.js: -------------------------------------------------------------------------------- 1 | 2 | var tx = 'http://{TXNODE IP}:8545'; 3 | var passpharse = '{Password}'; 4 | var fs = require('fs'); 5 | var Web3 = require('web3'); 6 | var web3 = new Web3(); 7 | var oracleContractAddress = '0x08c152C90F2775915B1EBC88C218A9B86307A775';//deployed contract checksum address 8 | var clientContractAddress = '0xc3a486e2c58d8b3713af5848eb4303dc7e81946b'; 9 | 10 | web3.setProvider(new web3.providers.HttpProvider(tx)); 11 | 12 | //unlock accounts that we'll be using 13 | web3.personal.unlockAccount(web3.eth.accounts[0],passpharse,30000); //sender 14 | 15 | var checksum = web3.toChecksumAddress(oracleContractAddress); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution 2 | 3 | # Git Flow 4 | 5 | The crypto-js project uses [git flow](https://github.com/nvie/gitflow) to manage branches. 6 | Do your changes on the `develop` or even better on a `feature/*` branch. Don't do any changes on the `master` branch. 7 | 8 | # Pull request 9 | 10 | Target your pull request on `develop` branch. Other pull request won't be accepted. 11 | 12 | # How to build 13 | 14 | 1. Clone 15 | 16 | 2. Run 17 | 18 | ```sh 19 | npm install 20 | ``` 21 | 22 | 3. Run 23 | 24 | ```sh 25 | npm run build 26 | ``` 27 | 28 | 4. Check `build` folder -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/package-init.js: -------------------------------------------------------------------------------- 1 | /* jshint ignore:start */ 2 | 3 | 4 | // Browser environment 5 | if(typeof window !== 'undefined') { 6 | Web3 = (typeof window.Web3 !== 'undefined') ? window.Web3 : require('web3'); 7 | BigNumber = (typeof window.BigNumber !== 'undefined') ? window.BigNumber : require('bignumber.js'); 8 | } 9 | 10 | 11 | // Node environment 12 | if(typeof global !== 'undefined') { 13 | Web3 = (typeof global.Web3 !== 'undefined') ? global.Web3 : require('web3'); 14 | BigNumber = (typeof global.BigNumber !== 'undefined') ? global.BigNumber : require('bignumber.js'); 15 | } 16 | 17 | /* jshint ignore:end */ -------------------------------------------------------------------------------- /smartcontractClient/readme.md: -------------------------------------------------------------------------------- 1 | # Ethereum Web3.js & smart contract samples 2 | 3 | Before you start to run the node.js sample code, you have to deploy your smart contract. My demo smart contract is located in /smartcontract folder. Install truffle and follow [instruction](http://truffleframework.com/tutorials/building-testing-frontend-app-truffle-3) to [deploy smart contract](https://truffle.readthedocs.io/en/beta/getting_started/migrations/) to your Ethereum network. 4 | 5 | Once you have smart contract deployed to Ethereum network, you can run the node.js sample: 6 | 7 | ```javascript 8 | cd nodeapp 9 | npm install 10 | node smartContractClient.js 11 | ``` 12 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution 2 | 3 | # Git Flow 4 | 5 | The crypto-js project uses [git flow](https://github.com/nvie/gitflow) to manage branches. 6 | Do your changes on the `develop` or even better on a `feature/*` branch. Don't do any changes on the `master` branch. 7 | 8 | # Pull request 9 | 10 | Target your pull request on `develop` branch. Other pull request won't be accepted. 11 | 12 | # How to build 13 | 14 | 1. Clone 15 | 16 | 2. Run 17 | 18 | ```sh 19 | npm install 20 | ``` 21 | 22 | 3. Run 23 | 24 | ```sh 25 | npm run build 26 | ``` 27 | 28 | 4. Check `build` folder -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/solidity/string.js: -------------------------------------------------------------------------------- 1 | var f = require('./formatters'); 2 | var SolidityType = require('./type'); 3 | 4 | var SolidityTypeString = function () { 5 | this._inputFormatter = f.formatInputString; 6 | this._outputFormatter = f.formatOutputString; 7 | }; 8 | 9 | SolidityTypeString.prototype = new SolidityType({}); 10 | SolidityTypeString.prototype.constructor = SolidityTypeString; 11 | 12 | SolidityTypeString.prototype.isType = function (name) { 13 | return !!name.match(/^string(\[([0-9]*)\])*$/); 14 | }; 15 | 16 | SolidityTypeString.prototype.isDynamicType = function () { 17 | return true; 18 | }; 19 | 20 | module.exports = SolidityTypeString; 21 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/coverage/prettify.css: -------------------------------------------------------------------------------- 1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@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}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} 2 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/coverage/lcov-report/prettify.css: -------------------------------------------------------------------------------- 1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@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}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} 2 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/test/src/responseurl_test.coffee: -------------------------------------------------------------------------------- 1 | describe 'XMLHttpRequest', -> 2 | describe '#responseURL', -> 3 | beforeEach -> 4 | @xhr = new XMLHttpRequest 5 | 6 | it 'provies the URL of the response', (done) -> 7 | @xhr.open 'GET', 'http://localhost:8912/_/method' 8 | @xhr.onload = => 9 | expect(@xhr.responseURL).to.equal("http://localhost:8912/_/method") 10 | done() 11 | @xhr.send() 12 | 13 | it 'ignores the hash fragment', (done) -> 14 | @xhr.open 'GET', 'http://localhost:8912/_/method#foo' 15 | @xhr.onload = => 16 | expect(@xhr.responseURL).to.equal("http://localhost:8912/_/method") 17 | done() 18 | @xhr.send() 19 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/pad-nopadding.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * A noop padding strategy. 18 | */ 19 | CryptoJS.pad.NoPadding = { 20 | pad: function () { 21 | }, 22 | 23 | unpad: function () { 24 | } 25 | }; 26 | 27 | 28 | return CryptoJS.pad.NoPadding; 29 | 30 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/LICENSE: -------------------------------------------------------------------------------- 1 | This file is part of web3.js. 2 | 3 | web3.js is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU Lesser General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | web3.js is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU Lesser General Public License for more details. 12 | 13 | You should have received a copy of the GNU Lesser General Public License 14 | along with web3.js. If not, see . 15 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/pad-nopadding.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * A noop padding strategy. 18 | */ 19 | CryptoJS.pad.NoPadding = { 20 | pad: function () { 21 | }, 22 | 23 | unpad: function () { 24 | } 25 | }; 26 | 27 | 28 | return CryptoJS.pad.NoPadding; 29 | 30 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/solidity/dynamicbytes.js: -------------------------------------------------------------------------------- 1 | var f = require('./formatters'); 2 | var SolidityType = require('./type'); 3 | 4 | var SolidityTypeDynamicBytes = function () { 5 | this._inputFormatter = f.formatInputDynamicBytes; 6 | this._outputFormatter = f.formatOutputDynamicBytes; 7 | }; 8 | 9 | SolidityTypeDynamicBytes.prototype = new SolidityType({}); 10 | SolidityTypeDynamicBytes.prototype.constructor = SolidityTypeDynamicBytes; 11 | 12 | SolidityTypeDynamicBytes.prototype.isType = function (name) { 13 | return !!name.match(/^bytes(\[([0-9]*)\])*$/); 14 | }; 15 | 16 | SolidityTypeDynamicBytes.prototype.isDynamicType = function () { 17 | return true; 18 | }; 19 | 20 | module.exports = SolidityTypeDynamicBytes; 21 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/solidity/bool.js: -------------------------------------------------------------------------------- 1 | var f = require('./formatters'); 2 | var SolidityType = require('./type'); 3 | 4 | /** 5 | * SolidityTypeBool is a prootype that represents bool type 6 | * It matches: 7 | * bool 8 | * bool[] 9 | * bool[4] 10 | * bool[][] 11 | * bool[3][] 12 | * bool[][6][], ... 13 | */ 14 | var SolidityTypeBool = function () { 15 | this._inputFormatter = f.formatInputBool; 16 | this._outputFormatter = f.formatOutputBool; 17 | }; 18 | 19 | SolidityTypeBool.prototype = new SolidityType({}); 20 | SolidityTypeBool.prototype.constructor = SolidityTypeBool; 21 | 22 | SolidityTypeBool.prototype.isType = function (name) { 23 | return !!name.match(/^bool(\[([0-9]*)\])*$/); 24 | }; 25 | 26 | module.exports = SolidityTypeBool; 27 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "crypto-js", 3 | "version": "3.1.8", 4 | "description": "JavaScript library of crypto standards.", 5 | "license": "MIT", 6 | "homepage": "http://github.com/brix/crypto-js", 7 | "repository": { 8 | "type": "git", 9 | "url": "http://github.com/brix/crypto-js.git" 10 | }, 11 | "keywords": [ 12 | "security", 13 | "crypto", 14 | "Hash", 15 | "MD5", 16 | "SHA1", 17 | "SHA-1", 18 | "SHA256", 19 | "SHA-256", 20 | "RC4", 21 | "Rabbit", 22 | "AES", 23 | "DES", 24 | "PBKDF2", 25 | "HMAC", 26 | "OFB", 27 | "CFB", 28 | "CTR", 29 | "CBC", 30 | "Base64" 31 | ], 32 | "main": "index.js", 33 | "dependencies": {}, 34 | "ignore": [] 35 | } 36 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "crypto-js", 3 | "version": "3.1.9", 4 | "description": "JavaScript library of crypto standards.", 5 | "license": "MIT", 6 | "homepage": "http://github.com/brix/crypto-js", 7 | "repository": { 8 | "type": "git", 9 | "url": "http://github.com/brix/crypto-js.git" 10 | }, 11 | "keywords": [ 12 | "security", 13 | "crypto", 14 | "Hash", 15 | "MD5", 16 | "SHA1", 17 | "SHA-1", 18 | "SHA256", 19 | "SHA-256", 20 | "RC4", 21 | "Rabbit", 22 | "AES", 23 | "DES", 24 | "PBKDF2", 25 | "HMAC", 26 | "OFB", 27 | "CFB", 28 | "CTR", 29 | "CBC", 30 | "Base64" 31 | ], 32 | "main": "index.js", 33 | "dependencies": {}, 34 | "ignore": [] 35 | } 36 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/solidity/address.js: -------------------------------------------------------------------------------- 1 | var f = require('./formatters'); 2 | var SolidityType = require('./type'); 3 | 4 | /** 5 | * SolidityTypeAddress is a prootype that represents address type 6 | * It matches: 7 | * address 8 | * address[] 9 | * address[4] 10 | * address[][] 11 | * address[3][] 12 | * address[][6][], ... 13 | */ 14 | var SolidityTypeAddress = function () { 15 | this._inputFormatter = f.formatInputInt; 16 | this._outputFormatter = f.formatOutputAddress; 17 | }; 18 | 19 | SolidityTypeAddress.prototype = new SolidityType({}); 20 | SolidityTypeAddress.prototype.constructor = SolidityTypeAddress; 21 | 22 | SolidityTypeAddress.prototype.isType = function (name) { 23 | return !!name.match(/address(\[([0-9]*)\])?/); 24 | }; 25 | 26 | module.exports = SolidityTypeAddress; 27 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/bignumber.js/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bignumber.js", 3 | "main": "bignumber.js", 4 | "version": "4.0.4", 5 | "homepage": "https://github.com/MikeMcl/bignumber.js", 6 | "authors": [ 7 | "Michael Mclaughlin " 8 | ], 9 | "description": "A library for arbitrary-precision decimal and non-decimal arithmetic", 10 | "moduleType": [ 11 | "amd", 12 | "globals", 13 | "node" 14 | ], 15 | "keywords": [ 16 | "arbitrary", 17 | "precision", 18 | "arithmetic", 19 | "big", 20 | "number", 21 | "decimal", 22 | "float", 23 | "biginteger", 24 | "bigdecimal", 25 | "bignumber", 26 | "bigint", 27 | "bignum" 28 | ], 29 | "license": "MIT", 30 | "ignore": [ 31 | ".*", 32 | "*.json", 33 | "test" 34 | ] 35 | } 36 | 37 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/node_modules/bignumber.js/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bignumber.js", 3 | "main": "bignumber.js", 4 | "version": "2.0.7", 5 | "homepage": "https://github.com/MikeMcl/bignumber.js", 6 | "authors": [ 7 | "Michael Mclaughlin " 8 | ], 9 | "description": "A library for arbitrary-precision decimal and non-decimal arithmetic", 10 | "moduleType": [ 11 | "amd", 12 | "globals", 13 | "node" 14 | ], 15 | "keywords": [ 16 | "arbitrary", 17 | "precision", 18 | "arithmetic", 19 | "big", 20 | "number", 21 | "decimal", 22 | "float", 23 | "biginteger", 24 | "bigdecimal", 25 | "bignumber", 26 | "bigint", 27 | "bignum" 28 | ], 29 | "license": "MIT", 30 | "ignore": [ 31 | ".*", 32 | "*.json", 33 | "test" 34 | ] 35 | } 36 | 37 | -------------------------------------------------------------------------------- /oracle/smartcontracts/OracleContract4.sol: -------------------------------------------------------------------------------- 1 | 2 | pragma solidity ^0.4.10; 3 | 4 | contract OracleContract4 { 5 | address owner; 6 | address public callbackAddress; 7 | string public state; 8 | 9 | event QueryEvent(bytes32 id, string query); 10 | 11 | function OracleContract4 () { 12 | owner = msg.sender; 13 | } 14 | 15 | modifier ownerOnly { 16 | require(owner == msg.sender); 17 | _; 18 | } 19 | function setCallbackAddress(address _callbackAddress) { 20 | callbackAddress = _callbackAddress; 21 | } 22 | 23 | function getRandomNumber() returns (uint) { 24 | return 12; 25 | } 26 | 27 | function query(string _query) returns (bytes32) { 28 | bytes32 id = sha3(block.number, now, _query, msg.sender); 29 | QueryEvent(id, _query); 30 | return id; 31 | } 32 | } -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/solidity/bytes.js: -------------------------------------------------------------------------------- 1 | var f = require('./formatters'); 2 | var SolidityType = require('./type'); 3 | 4 | /** 5 | * SolidityTypeBytes is a prototype that represents the bytes type. 6 | * It matches: 7 | * bytes 8 | * bytes[] 9 | * bytes[4] 10 | * bytes[][] 11 | * bytes[3][] 12 | * bytes[][6][], ... 13 | * bytes32 14 | * bytes8[4] 15 | * bytes[3][] 16 | */ 17 | var SolidityTypeBytes = function () { 18 | this._inputFormatter = f.formatInputBytes; 19 | this._outputFormatter = f.formatOutputBytes; 20 | }; 21 | 22 | SolidityTypeBytes.prototype = new SolidityType({}); 23 | SolidityTypeBytes.prototype.constructor = SolidityTypeBytes; 24 | 25 | SolidityTypeBytes.prototype.isType = function (name) { 26 | return !!name.match(/^bytes([0-9]{1,})(\[([0-9]*)\])*$/); 27 | }; 28 | 29 | module.exports = SolidityTypeBytes; 30 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/solidity/int.js: -------------------------------------------------------------------------------- 1 | var f = require('./formatters'); 2 | var SolidityType = require('./type'); 3 | 4 | /** 5 | * SolidityTypeInt is a prootype that represents int type 6 | * It matches: 7 | * int 8 | * int[] 9 | * int[4] 10 | * int[][] 11 | * int[3][] 12 | * int[][6][], ... 13 | * int32 14 | * int64[] 15 | * int8[4] 16 | * int256[][] 17 | * int[3][] 18 | * int64[][6][], ... 19 | */ 20 | var SolidityTypeInt = function () { 21 | this._inputFormatter = f.formatInputInt; 22 | this._outputFormatter = f.formatOutputInt; 23 | }; 24 | 25 | SolidityTypeInt.prototype = new SolidityType({}); 26 | SolidityTypeInt.prototype.constructor = SolidityTypeInt; 27 | 28 | SolidityTypeInt.prototype.isType = function (name) { 29 | return !!name.match(/^int([0-9]*)?(\[([0-9]*)\])*$/); 30 | }; 31 | 32 | module.exports = SolidityTypeInt; 33 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "crypto-js", 3 | "version": "3.1.9", 4 | "description": "JavaScript library of crypto standards.", 5 | "license": "MIT", 6 | "author": { 7 | "name": "Evan Vosberg", 8 | "url": "http://github.com/evanvosberg" 9 | }, 10 | "homepage": "http://github.com/brix/crypto-js", 11 | "repository": { 12 | "type": "git", 13 | "url": "http://github.com/brix/crypto-js.git" 14 | }, 15 | "keywords": [ 16 | "security", 17 | "crypto", 18 | "Hash", 19 | "MD5", 20 | "SHA1", 21 | "SHA-1", 22 | "SHA256", 23 | "SHA-256", 24 | "RC4", 25 | "Rabbit", 26 | "AES", 27 | "DES", 28 | "PBKDF2", 29 | "HMAC", 30 | "OFB", 31 | "CFB", 32 | "CTR", 33 | "CBC", 34 | "Base64" 35 | ], 36 | "main": "index.js", 37 | "dependencies": {} 38 | } 39 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/solidity/real.js: -------------------------------------------------------------------------------- 1 | var f = require('./formatters'); 2 | var SolidityType = require('./type'); 3 | 4 | /** 5 | * SolidityTypeReal is a prootype that represents real type 6 | * It matches: 7 | * real 8 | * real[] 9 | * real[4] 10 | * real[][] 11 | * real[3][] 12 | * real[][6][], ... 13 | * real32 14 | * real64[] 15 | * real8[4] 16 | * real256[][] 17 | * real[3][] 18 | * real64[][6][], ... 19 | */ 20 | var SolidityTypeReal = function () { 21 | this._inputFormatter = f.formatInputReal; 22 | this._outputFormatter = f.formatOutputReal; 23 | }; 24 | 25 | SolidityTypeReal.prototype = new SolidityType({}); 26 | SolidityTypeReal.prototype.constructor = SolidityTypeReal; 27 | 28 | SolidityTypeReal.prototype.isType = function (name) { 29 | return !!name.match(/real([0-9]*)?(\[([0-9]*)\])?/); 30 | }; 31 | 32 | module.exports = SolidityTypeReal; 33 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/solidity/uint.js: -------------------------------------------------------------------------------- 1 | var f = require('./formatters'); 2 | var SolidityType = require('./type'); 3 | 4 | /** 5 | * SolidityTypeUInt is a prootype that represents uint type 6 | * It matches: 7 | * uint 8 | * uint[] 9 | * uint[4] 10 | * uint[][] 11 | * uint[3][] 12 | * uint[][6][], ... 13 | * uint32 14 | * uint64[] 15 | * uint8[4] 16 | * uint256[][] 17 | * uint[3][] 18 | * uint64[][6][], ... 19 | */ 20 | var SolidityTypeUInt = function () { 21 | this._inputFormatter = f.formatInputInt; 22 | this._outputFormatter = f.formatOutputUInt; 23 | }; 24 | 25 | SolidityTypeUInt.prototype = new SolidityType({}); 26 | SolidityTypeUInt.prototype.constructor = SolidityTypeUInt; 27 | 28 | SolidityTypeUInt.prototype.isType = function (name) { 29 | return !!name.match(/^uint([0-9]*)?(\[([0-9]*)\])*$/); 30 | }; 31 | 32 | module.exports = SolidityTypeUInt; 33 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/solidity/ureal.js: -------------------------------------------------------------------------------- 1 | var f = require('./formatters'); 2 | var SolidityType = require('./type'); 3 | 4 | /** 5 | * SolidityTypeUReal is a prootype that represents ureal type 6 | * It matches: 7 | * ureal 8 | * ureal[] 9 | * ureal[4] 10 | * ureal[][] 11 | * ureal[3][] 12 | * ureal[][6][], ... 13 | * ureal32 14 | * ureal64[] 15 | * ureal8[4] 16 | * ureal256[][] 17 | * ureal[3][] 18 | * ureal64[][6][], ... 19 | */ 20 | var SolidityTypeUReal = function () { 21 | this._inputFormatter = f.formatInputReal; 22 | this._outputFormatter = f.formatOutputUReal; 23 | }; 24 | 25 | SolidityTypeUReal.prototype = new SolidityType({}); 26 | SolidityTypeUReal.prototype.constructor = SolidityTypeUReal; 27 | 28 | SolidityTypeUReal.prototype.isType = function (name) { 29 | return !!name.match(/^ureal([0-9]*)?(\[([0-9]*)\])*$/); 30 | }; 31 | 32 | module.exports = SolidityTypeUReal; 33 | -------------------------------------------------------------------------------- /smartcontractClient/nodeapp/package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "blockchicken", 4 | "description": "", 5 | "version": "0.1.0", 6 | "author": "Michael SH Chi", 7 | "contributors": [], 8 | "bugs": "http://github.com/johndoe/contactlist/issues", 9 | "engines": { 10 | "node": "~0.10.22" 11 | }, 12 | "dependencies": { 13 | "body-parser": "^1.9.0", 14 | "express": "^4.0.0", 15 | "jsonpath": "^0.2.0", 16 | "swaggerize-express": "^3.0.0", 17 | "swaggerize-ui": "^1.0.1", 18 | "web3":"^0.19.0", 19 | "solc": "^0.4.17", 20 | "web3-eth-contract": "^1.0.0-beta.22", 21 | "web3-eth-personal": "^1.0.0-beta.23" 22 | }, 23 | "devDependencies": { 24 | "tape": "^3.0.0", 25 | "jshint": "^2.4.1", 26 | "istanbul": "~0.2.3", 27 | "enjoi": "~0.1.16", 28 | "supertest": "~0.13.0" 29 | }, 30 | "scripts": { 31 | 32 | "lint": "jshint -c .jshintrc lib/**/*.js" 33 | }, 34 | "main": "./server" 35 | } 36 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/package.js: -------------------------------------------------------------------------------- 1 | /* jshint ignore:start */ 2 | Package.describe({ 3 | name: 'ethereum:web3', 4 | version: '0.20.4', 5 | summary: 'Ethereum JavaScript API, middleware to talk to a ethreum node over RPC', 6 | git: 'https://github.com/ethereum/ethereum.js', 7 | // By default, Meteor will default to using README.md for documentation. 8 | // To avoid submitting documentation, set this field to null. 9 | documentation: 'README.md' 10 | }); 11 | 12 | Npm.depends({ 13 | "xmlhttprequest": "1.7.0" 14 | }); 15 | 16 | 17 | Package.onUse(function(api) { 18 | api.versionsFrom('1.0.3.2'); 19 | 20 | // api.use('3stack:bignumber@2.0.0', 'client'); 21 | 22 | api.export(['Web3', 'BigNumber'], ['client', 'server']); 23 | 24 | api.addFiles('dist/web3.js', ['client', 'server']); 25 | api.addFiles('package-init.js', ['client', 'server']); 26 | }); 27 | 28 | // Package.onTest(function(api) { 29 | // api.use('tinytest'); 30 | // api.use('test'); 31 | // api.addFiles('test-tests.js'); 32 | // }); 33 | /* jshint ignore:end */ 34 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/src/errors.coffee: -------------------------------------------------------------------------------- 1 | # This file defines the custom errors used in the XMLHttpRequest specification. 2 | 3 | # Thrown if the XHR security policy is violated. 4 | class SecurityError extends Error 5 | # @private 6 | constructor: -> super 7 | 8 | # Thrown if the XHR security policy is violated. 9 | XMLHttpRequest.SecurityError = SecurityError 10 | 11 | 12 | # Usually thrown if the XHR is in the wrong readyState for an operation. 13 | class InvalidStateError extends Error 14 | # @private 15 | constructor: -> super 16 | 17 | # Usually thrown if the XHR is in the wrong readyState for an operation. 18 | class InvalidStateError extends Error 19 | XMLHttpRequest.InvalidStateError = InvalidStateError 20 | 21 | # Thrown if there is a problem with the URL passed to the XHR. 22 | class NetworkError extends Error 23 | # @private 24 | constructor: -> super 25 | 26 | # Thrown if parsing URLs errors out. 27 | XMLHttpRequest.SyntaxError = SyntaxError 28 | 29 | class SyntaxError extends Error 30 | # @private: 31 | constructor: -> super 32 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "crypto-js", 3 | "version": "3.1.9", 4 | "description": "JavaScript library of crypto standards.", 5 | "license": "MIT", 6 | "homepage": "http://github.com/brix/crypto-js", 7 | "repository": { 8 | "type": "git", 9 | "url": "http://github.com/brix/crypto-js.git" 10 | }, 11 | "keywords": [ 12 | "security", 13 | "crypto", 14 | "Hash", 15 | "MD5", 16 | "SHA1", 17 | "SHA-1", 18 | "SHA256", 19 | "SHA-256", 20 | "RC4", 21 | "Rabbit", 22 | "AES", 23 | "DES", 24 | "PBKDF2", 25 | "HMAC", 26 | "OFB", 27 | "CFB", 28 | "CTR", 29 | "CBC", 30 | "Base64" 31 | ], 32 | "main": "index.js", 33 | "dependencies": {}, 34 | "ignore": [], 35 | "_release": "3.1.9", 36 | "_resolution": { 37 | "type": "version", 38 | "tag": "3.1.9", 39 | "commit": "c8ac779bb0f5b8c7947422e09e96c75d768b019e" 40 | }, 41 | "_source": "https://github.com/brix/crypto-js.git", 42 | "_target": "~3.1.4", 43 | "_originalSource": "crypto-js" 44 | } -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/mode-ecb.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * Electronic Codebook block mode. 18 | */ 19 | CryptoJS.mode.ECB = (function () { 20 | var ECB = CryptoJS.lib.BlockCipherMode.extend(); 21 | 22 | ECB.Encryptor = ECB.extend({ 23 | processBlock: function (words, offset) { 24 | this._cipher.encryptBlock(words, offset); 25 | } 26 | }); 27 | 28 | ECB.Decryptor = ECB.extend({ 29 | processBlock: function (words, offset) { 30 | this._cipher.decryptBlock(words, offset); 31 | } 32 | }); 33 | 34 | return ECB; 35 | }()); 36 | 37 | 38 | return CryptoJS.mode.ECB; 39 | 40 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/mode-ecb.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * Electronic Codebook block mode. 18 | */ 19 | CryptoJS.mode.ECB = (function () { 20 | var ECB = CryptoJS.lib.BlockCipherMode.extend(); 21 | 22 | ECB.Encryptor = ECB.extend({ 23 | processBlock: function (words, offset) { 24 | this._cipher.encryptBlock(words, offset); 25 | } 26 | }); 27 | 28 | ECB.Decryptor = ECB.extend({ 29 | processBlock: function (words, offset) { 30 | this._cipher.decryptBlock(words, offset); 31 | } 32 | }); 33 | 34 | return ECB; 35 | }()); 36 | 37 | 38 | return CryptoJS.mode.ECB; 39 | 40 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/pad-iso97971.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * ISO/IEC 9797-1 Padding Method 2. 18 | */ 19 | CryptoJS.pad.Iso97971 = { 20 | pad: function (data, blockSize) { 21 | // Add 0x80 byte 22 | data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1)); 23 | 24 | // Zero pad the rest 25 | CryptoJS.pad.ZeroPadding.pad(data, blockSize); 26 | }, 27 | 28 | unpad: function (data) { 29 | // Remove zero padding 30 | CryptoJS.pad.ZeroPadding.unpad(data); 31 | 32 | // Remove one more byte -- the 0x80 byte 33 | data.sigBytes--; 34 | } 35 | }; 36 | 37 | 38 | return CryptoJS.pad.Iso97971; 39 | 40 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/bignumber.js/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bignumber.js", 3 | "main": "bignumber.js", 4 | "version": "4.0.4", 5 | "homepage": "https://github.com/MikeMcl/bignumber.js", 6 | "authors": [ 7 | "Michael Mclaughlin " 8 | ], 9 | "description": "A library for arbitrary-precision decimal and non-decimal arithmetic", 10 | "moduleType": [ 11 | "amd", 12 | "globals", 13 | "node" 14 | ], 15 | "keywords": [ 16 | "arbitrary", 17 | "precision", 18 | "arithmetic", 19 | "big", 20 | "number", 21 | "decimal", 22 | "float", 23 | "biginteger", 24 | "bigdecimal", 25 | "bignumber", 26 | "bigint", 27 | "bignum" 28 | ], 29 | "license": "MIT", 30 | "ignore": [ 31 | ".*", 32 | "*.json", 33 | "test" 34 | ], 35 | "_release": "4.0.4", 36 | "_resolution": { 37 | "type": "version", 38 | "tag": "v4.0.4", 39 | "commit": "cf004586180c1e28129676d0c42d6c51930714c2" 40 | }, 41 | "_source": "https://github.com/MikeMcl/bignumber.js.git", 42 | "_target": ">=2.0.0", 43 | "_originalSource": "bignumber.js" 44 | } -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/pad-iso97971.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * ISO/IEC 9797-1 Padding Method 2. 18 | */ 19 | CryptoJS.pad.Iso97971 = { 20 | pad: function (data, blockSize) { 21 | // Add 0x80 byte 22 | data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1)); 23 | 24 | // Zero pad the rest 25 | CryptoJS.pad.ZeroPadding.pad(data, blockSize); 26 | }, 27 | 28 | unpad: function (data) { 29 | // Remove zero padding 30 | CryptoJS.pad.ZeroPadding.unpad(data); 31 | 32 | // Remove one more byte -- the 0x80 byte 33 | data.sigBytes--; 34 | } 35 | }; 36 | 37 | 38 | return CryptoJS.pad.Iso97971; 39 | 40 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Victor Costan 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/utf8/LICENSE-MIT.txt: -------------------------------------------------------------------------------- 1 | Copyright Mathias Bynens 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xmlhttprequest/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 passive.ly LLC 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /document-sign-demo/README.md: -------------------------------------------------------------------------------- 1 | # Preparation # 2 | =========== 3 | 4 | - Download compiled [web3.js](https://github.com/ethereum/web3.js) 5 | 6 | - Download 7 | [pscp.exe](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html) 8 | 9 | - Execute below command to copy file from your truffle environment in the 10 | cloud to your local machine 11 | 12 | > pscp azureuser\@\:\ OUTPUT FOLDER\>/\*.json 14 | 15 | # Overview # 16 | ======== 17 | 18 | This sample demonstrate smart-contracts design for certificate scenario, when a 19 | ship owner request to build a ship, he submit request to shipyard for Builder 20 | certificate and once it is completed kick-off the rest certificate process. 21 | 22 | Contracts are design as below, we use a Vessel contract to track different 23 | certificates for different ships, each ship are identified by IMO number 24 | 25 |  26 | 27 | In this sample, we do not hold certificate state such as Initiated, Singed in 28 | contracts, but in some scenario you may want to hold certificate status in your 29 | contract in order to track its state and decide what are available actions. 30 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/node_modules/bignumber.js/LICENCE: -------------------------------------------------------------------------------- 1 | The MIT Expat Licence. 2 | 3 | Copyright (c) 2012 Michael Mclaughlin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /smartcontractClient/nodeapp/simplecontractapp.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var tx = 'http://{tx node ip}:8545'; 3 | var fs = require('fs'); 4 | var Web3 = require('web3'); 5 | var web3 = new Web3(); 6 | 7 | web3.setProvider(new web3.providers.HttpProvider(tx));//, 0, BasicAuthUsername, BasicAuthPassword)); 8 | 9 | web3.personal.unlockAccount(web3.eth.accounts[0],'{pass}'); 10 | var text = fs.readFileSync('./contracts/SimpleContract.json','utf8'); 11 | var contractInterface = JSON.parse(text); 12 | var address = '0x75e394b64d531c1c81ca8734d127dd30d1ab7d4a'; 13 | 14 | //var cf3 = web3.eth.contract(contractInterface.abi).new('test123','test456',{from:web3.eth.accounts[0],data:contractInterface.unlinked_binary,gas:3000000}); 15 | var contract = web3.eth.contract(contractInterface.abi).at(address); 16 | console.log(contract.address);//0x75e394b64d531c1c81ca8734d127dd30d1ab7d4a 17 | contract.UpdateExchangeRate(123); 18 | contract.exchangeRate.call();//123 19 | 20 | var contract2 = web3.eth.contract(contractInterface.abi).at(address); 21 | contract2.exchangeRate.call();//123 22 | 23 | var contract3 = web3.eth.contract(contractInterface.abi).new({from:web3.eth.accounts[0],data:contractInterface.unlinked_binary,gas:3000000}); 24 | contract3.exchangeRate.call();//0 25 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/bignumber.js/LICENCE: -------------------------------------------------------------------------------- 1 | The MIT Licence. 2 | 3 | Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017 Michael Mclaughlin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/pad-zeropadding.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * Zero padding strategy. 18 | */ 19 | CryptoJS.pad.ZeroPadding = { 20 | pad: function (data, blockSize) { 21 | // Shortcut 22 | var blockSizeBytes = blockSize * 4; 23 | 24 | // Pad 25 | data.clamp(); 26 | data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes); 27 | }, 28 | 29 | unpad: function (data) { 30 | // Shortcut 31 | var dataWords = data.words; 32 | 33 | // Unpad 34 | var i = data.sigBytes - 1; 35 | while (!((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) { 36 | i--; 37 | } 38 | data.sigBytes = i + 1; 39 | } 40 | }; 41 | 42 | 43 | return CryptoJS.pad.ZeroPadding; 44 | 45 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/pad-zeropadding.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * Zero padding strategy. 18 | */ 19 | CryptoJS.pad.ZeroPadding = { 20 | pad: function (data, blockSize) { 21 | // Shortcut 22 | var blockSizeBytes = blockSize * 4; 23 | 24 | // Pad 25 | data.clamp(); 26 | data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes); 27 | }, 28 | 29 | unpad: function (data) { 30 | // Shortcut 31 | var dataWords = data.words; 32 | 33 | // Unpad 34 | var i = data.sigBytes - 1; 35 | while (!((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) { 36 | i--; 37 | } 38 | data.sigBytes = i + 1; 39 | } 40 | }; 41 | 42 | 43 | return CryptoJS.pad.ZeroPadding; 44 | 45 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/test/html/browser_test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | node-xhr2 browser tests 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/LICENSE: -------------------------------------------------------------------------------- 1 | # License 2 | 3 | [The MIT License (MIT)](http://opensource.org/licenses/MIT) 4 | 5 | Copyright (c) 2009-2013 Jeff Mott 6 | Copyright (c) 2013-2016 Evan Vosberg 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/LICENSE: -------------------------------------------------------------------------------- 1 | # License 2 | 3 | [The MIT License (MIT)](http://opensource.org/licenses/MIT) 4 | 5 | Copyright (c) 2009-2013 Jeff Mott 6 | Copyright (c) 2013-2016 Evan Vosberg 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/pad-iso10126.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * ISO 10126 padding strategy. 18 | */ 19 | CryptoJS.pad.Iso10126 = { 20 | pad: function (data, blockSize) { 21 | // Shortcut 22 | var blockSizeBytes = blockSize * 4; 23 | 24 | // Count padding bytes 25 | var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; 26 | 27 | // Pad 28 | data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)). 29 | concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1)); 30 | }, 31 | 32 | unpad: function (data) { 33 | // Get number of padding bytes from last byte 34 | var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; 35 | 36 | // Remove padding 37 | data.sigBytes -= nPaddingBytes; 38 | } 39 | }; 40 | 41 | 42 | return CryptoJS.pad.Iso10126; 43 | 44 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/pad-iso10126.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * ISO 10126 padding strategy. 18 | */ 19 | CryptoJS.pad.Iso10126 = { 20 | pad: function (data, blockSize) { 21 | // Shortcut 22 | var blockSizeBytes = blockSize * 4; 23 | 24 | // Count padding bytes 25 | var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; 26 | 27 | // Pad 28 | data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)). 29 | concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1)); 30 | }, 31 | 32 | unpad: function (data) { 33 | // Get number of padding bytes from last byte 34 | var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; 35 | 36 | // Remove padding 37 | data.sigBytes -= nPaddingBytes; 38 | } 39 | }; 40 | 41 | 42 | return CryptoJS.pad.Iso10126; 43 | 44 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/src/progress_event.coffee: -------------------------------------------------------------------------------- 1 | # http://xhr.spec.whatwg.org/#interface-progressevent 2 | class ProgressEvent 3 | # Creates a new event. 4 | # 5 | # @param {String} type the event type, e.g. 'readystatechange'; must be 6 | # lowercased 7 | constructor: (@type) -> 8 | @target = null 9 | @currentTarget = null 10 | @lengthComputable = false 11 | @loaded = 0 12 | @total = 0 13 | # Getting the time from the OS is expensive, skip on that for now. 14 | # @timeStamp = Date.now() 15 | 16 | # @property {Boolean} for compatibility with DOM events 17 | bubbles: false 18 | 19 | # @property {Boolean} for fompatibility with DOM events 20 | cancelable: false 21 | 22 | # @property {XMLHttpRequest} the request that caused this event 23 | target: null 24 | 25 | # @property {Number} number of bytes that have already been downloaded or 26 | # uploaded 27 | loaded: null 28 | 29 | # @property {Boolean} true if the Content-Length response header is available 30 | # and the value of the event's total property is meaningful 31 | lengthComputable: null 32 | 33 | # @property {Number} number of bytes that will be downloaded or uploaded by 34 | # the request that fired the event 35 | total: null 36 | 37 | 38 | # The XHR spec exports the ProgressEvent constructor. 39 | XMLHttpRequest.ProgressEvent = ProgressEvent 40 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/utils/sha3.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of web3.js. 3 | 4 | web3.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | web3.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with web3.js. If not, see . 16 | */ 17 | /** 18 | * @file sha3.js 19 | * @author Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | var CryptoJS = require('crypto-js'); 24 | var sha3 = require('crypto-js/sha3'); 25 | 26 | module.exports = function (value, options) { 27 | if (options && options.encoding === 'hex') { 28 | if (value.length > 2 && value.substr(0, 2) === '0x') { 29 | value = value.substr(2); 30 | } 31 | value = CryptoJS.enc.Hex.parse(value); 32 | } 33 | 34 | return sha3(value, { 35 | outputLength: 256 36 | }).toString(); 37 | }; 38 | 39 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # xhr2 Contribution Policy 2 | 3 | This is an open-source library and welcomes outside contributions. 4 | 5 | Please file bugs on 6 | [the GitHub issue page](https://github.com/pwnall/xhr2/issues). 7 | 8 | Please submit patches as 9 | [GitHub pull requests](https://help.github.com/articles/using-pull-requests). 10 | Please check the 11 | [existing pull requests](https://github.com/pwnall/xhr2/issues) to avoid 12 | duplicating effort. 13 | 14 | 15 | ## Pull Request Checklist 16 | 17 | * Do not modify the version in `package.json` or the commit history. Feel free 18 | to rebase your commits while the pull request is in progress. 19 | * If your patch adds new functionality, please make sure to include link to the 20 | relevant parts of the 21 | [W3C XMLHttpRequest specification](http://www.w3.org/TR/XMLHttpRequest/). Use 22 | the same style as existing source code. 23 | * Include tests whenever possible, so the functionality won't be broken by 24 | accident in future releases. 25 | 26 | 27 | ## Obligatory Legalese 28 | 29 | By submitting a contribution to the library, you grant Victor Costan 30 | (the library's author) a non-exclusive, irrevocable, perpetual, transferable, 31 | license to use, reproduce, modify, adapt, publish, translate, create derivative 32 | works from, distribute, perform and display your contribution (in whole or 33 | part) worldwide under the MIT license. 34 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/web3/namereg.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of web3.js. 3 | 4 | web3.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | web3.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with web3.js. If not, see . 16 | */ 17 | /** 18 | * @file namereg.js 19 | * @author Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | var globalRegistrarAbi = require('../contracts/GlobalRegistrar.json'); 24 | var icapRegistrarAbi= require('../contracts/ICAPRegistrar.json'); 25 | 26 | var globalNameregAddress = '0xc6d9d2cd449a754c494264e1809c50e34d64562b'; 27 | var icapNameregAddress = '0xa1a111bc074c9cfa781f0c38e63bd51c91b8af00'; 28 | 29 | module.exports = { 30 | global: { 31 | abi: globalRegistrarAbi, 32 | address: globalNameregAddress 33 | }, 34 | icap: { 35 | abi: icapRegistrarAbi, 36 | address: icapNameregAddress 37 | } 38 | }; 39 | 40 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/example/balance.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 28 | 29 | 30 | coinbase balance 31 | watch balance 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/pad-ansix923.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * ANSI X.923 padding strategy. 18 | */ 19 | CryptoJS.pad.AnsiX923 = { 20 | pad: function (data, blockSize) { 21 | // Shortcuts 22 | var dataSigBytes = data.sigBytes; 23 | var blockSizeBytes = blockSize * 4; 24 | 25 | // Count padding bytes 26 | var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes; 27 | 28 | // Compute last byte position 29 | var lastBytePos = dataSigBytes + nPaddingBytes - 1; 30 | 31 | // Pad 32 | data.clamp(); 33 | data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8); 34 | data.sigBytes += nPaddingBytes; 35 | }, 36 | 37 | unpad: function (data) { 38 | // Get number of padding bytes from last byte 39 | var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; 40 | 41 | // Remove padding 42 | data.sigBytes -= nPaddingBytes; 43 | } 44 | }; 45 | 46 | 47 | return CryptoJS.pad.Ansix923; 48 | 49 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/pad-ansix923.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * ANSI X.923 padding strategy. 18 | */ 19 | CryptoJS.pad.AnsiX923 = { 20 | pad: function (data, blockSize) { 21 | // Shortcuts 22 | var dataSigBytes = data.sigBytes; 23 | var blockSizeBytes = blockSize * 4; 24 | 25 | // Count padding bytes 26 | var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes; 27 | 28 | // Compute last byte position 29 | var lastBytePos = dataSigBytes + nPaddingBytes - 1; 30 | 31 | // Pad 32 | data.clamp(); 33 | data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8); 34 | data.sigBytes += nPaddingBytes; 35 | }, 36 | 37 | unpad: function (data) { 38 | // Get number of padding bytes from last byte 39 | var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; 40 | 41 | // Remove padding 42 | data.sigBytes -= nPaddingBytes; 43 | } 44 | }; 45 | 46 | 47 | return CryptoJS.pad.Ansix923; 48 | 49 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/bignumber.js/perf/lib/bigdecimal_GWT/bugs.js: -------------------------------------------------------------------------------- 1 | // node bugs 2 | // Compare with BigDecTest.java 3 | 4 | var i, x, y, r, 5 | BigDecimal = require('./bigdecimal').BigDecimal; 6 | 7 | // remainder 8 | 9 | x = new BigDecimal("9.785496E-2"); 10 | y = new BigDecimal("-5.9219189762E-2"); 11 | r = x.remainder(y); 12 | console.log( r.toString() ); 13 | // 0.09785496 14 | // Should be 0.038635770238 15 | 16 | x = new BigDecimal("1.23693014661017964112E-5"); 17 | y = new BigDecimal("-6.9318042E-7"); 18 | r = x.remainder(y); 19 | console.log( r.toPlainString() ); 20 | // 0.0000123693014661017964112 21 | // Should be 0.0000005852343261017964112 22 | 23 | // divide 24 | 25 | x = new BigDecimal("6.9609119610E-78"); 26 | y = new BigDecimal("4E-48"); 27 | r = x.divide(y, 40, 6); // ROUND_HALF_EVEN 28 | console.log( r.toString() ); 29 | // 1.7402279903E-30 30 | // Should be 1.7402279902E-30 31 | 32 | x = new BigDecimal("5.383458817E-83"); 33 | y = new BigDecimal("8E-54"); 34 | r = x.divide(y, 40, 6); 35 | console.log( r.toString() ); 36 | // 6.7293235213E-30 37 | // Should be 6.7293235212E-30 38 | 39 | // compareTo 40 | 41 | x = new BigDecimal("0.04"); 42 | y = new BigDecimal("0.079393068"); 43 | i = x.compareTo(y); 44 | console.log(i); 45 | // 1 46 | // Should be -1 47 | 48 | x = new BigDecimal("7.88749578569876987785987658649E-10"); 49 | y = new BigDecimal("4.2545098709E-6"); 50 | i = x.compareTo(y); 51 | console.log(i); 52 | // 1 53 | // Should be -1 -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/web3/extend.js: -------------------------------------------------------------------------------- 1 | var formatters = require('./formatters'); 2 | var utils = require('./../utils/utils'); 3 | var Method = require('./method'); 4 | var Property = require('./property'); 5 | 6 | // TODO: refactor, so the input params are not altered. 7 | // it's necessary to make same 'extension' work with multiple providers 8 | var extend = function (web3) { 9 | /* jshint maxcomplexity:5 */ 10 | var ex = function (extension) { 11 | 12 | var extendedObject; 13 | if (extension.property) { 14 | if (!web3[extension.property]) { 15 | web3[extension.property] = {}; 16 | } 17 | extendedObject = web3[extension.property]; 18 | } else { 19 | extendedObject = web3; 20 | } 21 | 22 | if (extension.methods) { 23 | extension.methods.forEach(function (method) { 24 | method.attachToObject(extendedObject); 25 | method.setRequestManager(web3._requestManager); 26 | }); 27 | } 28 | 29 | if (extension.properties) { 30 | extension.properties.forEach(function (property) { 31 | property.attachToObject(extendedObject); 32 | property.setRequestManager(web3._requestManager); 33 | }); 34 | } 35 | }; 36 | 37 | ex.formatters = formatters; 38 | ex.utils = utils; 39 | ex.Method = Method; 40 | ex.Property = Property; 41 | 42 | return ex; 43 | }; 44 | 45 | 46 | 47 | module.exports = extend; 48 | 49 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "web3", 3 | "namespace": "ethereum", 4 | "version": "0.17.0-alpha", 5 | "description": "Ethereum Compatible JavaScript API", 6 | "main": [ 7 | "./dist/web3.js", 8 | "./dist/web3.min.js" 9 | ], 10 | "dependencies": { 11 | "bignumber.js": ">=2.0.0", 12 | "crypto-js": "~3.1.4" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "https://github.com/ethereum/web3.js.git" 17 | }, 18 | "homepage": "https://github.com/ethereum/web3.js", 19 | "bugs": { 20 | "url": "https://github.com/ethereum/web3.js/issues" 21 | }, 22 | "keywords": [ 23 | "ethereum", 24 | "javascript", 25 | "API" 26 | ], 27 | "authors": [ 28 | { 29 | "name": "Marek Kotewicz", 30 | "email": "marek@ethdev.com", 31 | "homepage": "https://github.com/debris" 32 | }, 33 | { 34 | "name": "Marian Oancea", 35 | "email": "marian@ethdev.com", 36 | "homepage": "https://github.com/cubedro" 37 | }, 38 | { 39 | "name": "Fabian Vogelsteller", 40 | "email": "fabian@ethdev.com", 41 | "homepage": "https://github.com/frozeman" 42 | } 43 | ], 44 | "license": "LGPL-3.0", 45 | "ignore": [ 46 | "example", 47 | "lib", 48 | "node_modules", 49 | "package.json", 50 | "package.js", 51 | ".versions", 52 | ".bowerrc", 53 | ".editorconfig", 54 | ".gitignore", 55 | ".jshintrc", 56 | ".npmignore", 57 | ".travis.yml", 58 | "gulpfile.js", 59 | "index.js", 60 | "**/*.txt" 61 | ] 62 | } 63 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/mode-ofb.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * Output Feedback block mode. 18 | */ 19 | CryptoJS.mode.OFB = (function () { 20 | var OFB = CryptoJS.lib.BlockCipherMode.extend(); 21 | 22 | var Encryptor = OFB.Encryptor = OFB.extend({ 23 | processBlock: function (words, offset) { 24 | // Shortcuts 25 | var cipher = this._cipher 26 | var blockSize = cipher.blockSize; 27 | var iv = this._iv; 28 | var keystream = this._keystream; 29 | 30 | // Generate keystream 31 | if (iv) { 32 | keystream = this._keystream = iv.slice(0); 33 | 34 | // Remove IV for subsequent blocks 35 | this._iv = undefined; 36 | } 37 | cipher.encryptBlock(keystream, 0); 38 | 39 | // Encrypt 40 | for (var i = 0; i < blockSize; i++) { 41 | words[offset + i] ^= keystream[i]; 42 | } 43 | } 44 | }); 45 | 46 | OFB.Decryptor = Encryptor; 47 | 48 | return OFB; 49 | }()); 50 | 51 | 52 | return CryptoJS.mode.OFB; 53 | 54 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/mode-ofb.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * Output Feedback block mode. 18 | */ 19 | CryptoJS.mode.OFB = (function () { 20 | var OFB = CryptoJS.lib.BlockCipherMode.extend(); 21 | 22 | var Encryptor = OFB.Encryptor = OFB.extend({ 23 | processBlock: function (words, offset) { 24 | // Shortcuts 25 | var cipher = this._cipher 26 | var blockSize = cipher.blockSize; 27 | var iv = this._iv; 28 | var keystream = this._keystream; 29 | 30 | // Generate keystream 31 | if (iv) { 32 | keystream = this._keystream = iv.slice(0); 33 | 34 | // Remove IV for subsequent blocks 35 | this._iv = undefined; 36 | } 37 | cipher.encryptBlock(keystream, 0); 38 | 39 | // Encrypt 40 | for (var i = 0; i < blockSize; i++) { 41 | words[offset + i] ^= keystream[i]; 42 | } 43 | } 44 | }); 45 | 46 | OFB.Decryptor = Encryptor; 47 | 48 | return OFB; 49 | }()); 50 | 51 | 52 | return CryptoJS.mode.OFB; 53 | 54 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/index.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./x64-core"), require("./lib-typedarrays"), require("./enc-utf16"), require("./enc-base64"), require("./md5"), require("./sha1"), require("./sha256"), require("./sha224"), require("./sha512"), require("./sha384"), require("./sha3"), require("./ripemd160"), require("./hmac"), require("./pbkdf2"), require("./evpkdf"), require("./cipher-core"), require("./mode-cfb"), require("./mode-ctr"), require("./mode-ctr-gladman"), require("./mode-ofb"), require("./mode-ecb"), require("./pad-ansix923"), require("./pad-iso10126"), require("./pad-iso97971"), require("./pad-zeropadding"), require("./pad-nopadding"), require("./format-hex"), require("./aes"), require("./tripledes"), require("./rc4"), require("./rabbit"), require("./rabbit-legacy")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./x64-core", "./lib-typedarrays", "./enc-utf16", "./enc-base64", "./md5", "./sha1", "./sha256", "./sha224", "./sha512", "./sha384", "./sha3", "./ripemd160", "./hmac", "./pbkdf2", "./evpkdf", "./cipher-core", "./mode-cfb", "./mode-ctr", "./mode-ctr-gladman", "./mode-ofb", "./mode-ecb", "./pad-ansix923", "./pad-iso10126", "./pad-iso97971", "./pad-zeropadding", "./pad-nopadding", "./format-hex", "./aes", "./tripledes", "./rc4", "./rabbit", "./rabbit-legacy"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | root.CryptoJS = factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/index.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./x64-core"), require("./lib-typedarrays"), require("./enc-utf16"), require("./enc-base64"), require("./md5"), require("./sha1"), require("./sha256"), require("./sha224"), require("./sha512"), require("./sha384"), require("./sha3"), require("./ripemd160"), require("./hmac"), require("./pbkdf2"), require("./evpkdf"), require("./cipher-core"), require("./mode-cfb"), require("./mode-ctr"), require("./mode-ctr-gladman"), require("./mode-ofb"), require("./mode-ecb"), require("./pad-ansix923"), require("./pad-iso10126"), require("./pad-iso97971"), require("./pad-zeropadding"), require("./pad-nopadding"), require("./format-hex"), require("./aes"), require("./tripledes"), require("./rc4"), require("./rabbit"), require("./rabbit-legacy")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./x64-core", "./lib-typedarrays", "./enc-utf16", "./enc-base64", "./md5", "./sha1", "./sha256", "./sha224", "./sha512", "./sha384", "./sha3", "./ripemd160", "./hmac", "./pbkdf2", "./evpkdf", "./cipher-core", "./mode-cfb", "./mode-ctr", "./mode-ctr-gladman", "./mode-ofb", "./mode-ecb", "./pad-ansix923", "./pad-iso10126", "./pad-iso97971", "./pad-zeropadding", "./pad-nopadding", "./format-hex", "./aes", "./tripledes", "./rc4", "./rabbit", "./rabbit-legacy"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | root.CryptoJS = factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS; 17 | 18 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xmlhttprequest/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_args": [ 3 | [ 4 | "xmlhttprequest@1.8.0", 5 | "C:\\Temp\\0-Blockchain\\MPA" 6 | ] 7 | ], 8 | "_from": "xmlhttprequest@1.8.0", 9 | "_id": "xmlhttprequest@1.8.0", 10 | "_inBundle": false, 11 | "_integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=", 12 | "_location": "/xmlhttprequest", 13 | "_phantomChildren": {}, 14 | "_requested": { 15 | "type": "version", 16 | "registry": true, 17 | "raw": "xmlhttprequest@1.8.0", 18 | "name": "xmlhttprequest", 19 | "escapedName": "xmlhttprequest", 20 | "rawSpec": "1.8.0", 21 | "saveSpec": null, 22 | "fetchSpec": "1.8.0" 23 | }, 24 | "_requiredBy": [ 25 | "/web3" 26 | ], 27 | "_resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", 28 | "_spec": "1.8.0", 29 | "_where": "C:\\Temp\\0-Blockchain\\MPA", 30 | "author": { 31 | "name": "Dan DeFelippi", 32 | "url": "http://driverdan.com" 33 | }, 34 | "bugs": { 35 | "url": "http://github.com/driverdan/node-XMLHttpRequest/issues" 36 | }, 37 | "description": "XMLHttpRequest for Node", 38 | "directories": { 39 | "lib": "./lib", 40 | "example": "./example" 41 | }, 42 | "engines": { 43 | "node": ">=0.4.0" 44 | }, 45 | "homepage": "https://github.com/driverdan/node-XMLHttpRequest#readme", 46 | "keywords": [ 47 | "xhr", 48 | "ajax" 49 | ], 50 | "license": "MIT", 51 | "main": "./lib/XMLHttpRequest.js", 52 | "name": "xmlhttprequest", 53 | "repository": { 54 | "type": "git", 55 | "url": "git://github.com/driverdan/node-XMLHttpRequest.git" 56 | }, 57 | "version": "1.8.0" 58 | } 59 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/test/src/helpers/setup.coffee: -------------------------------------------------------------------------------- 1 | if typeof window is 'undefined' 2 | # node.js 3 | global.XMLHttpRequest = require '../../../lib/xhr2' 4 | global.ProgressEvent = XMLHttpRequest.ProgressEvent 5 | global.NetworkError = XMLHttpRequest.NetworkError 6 | global.SecurityError = XMLHttpRequest.SecurityError 7 | global.InvalidStateError = XMLHttpRequest.InvalidStateError 8 | 9 | global.chai = require 'chai' 10 | global.assert = global.chai.assert 11 | global.expect = global.chai.expect 12 | global.sinon = require 'sinon' 13 | global.sinonChai = require 'sinon-chai' 14 | 15 | xhrServer = require './xhr_server' 16 | require './xhr2.png.js' 17 | 18 | https = require 'https' 19 | agent = new https.Agent 20 | agent.options.rejectUnauthorized = true 21 | agent.options.ca = xhrServer.https.sslCertificate() 22 | global.XMLHttpRequest.nodejsSet httpsAgent: agent 23 | console.log xhrServer.http.testUrl() 24 | global.XMLHttpRequest.nodejsSet( 25 | baseUrl: xhrServer.http.testUrl().replace('https://', 'http://')) 26 | else 27 | # browser 28 | 29 | # HACK(pwnall): the test is first loaded on https so the developer can bypass 30 | # the SSL interstitial; however, we need to run the test on http, because 31 | # Chrome blocks https -> http XHRs 32 | if window.location.href.indexOf('https://') is 0 33 | window.location.href = window.location.href.replace('https://', 'http://'). 34 | replace(':8911', ':8912') 35 | 36 | window.NetworkError = window.Error 37 | window.SecurityError = window.Error 38 | window.assert = window.chai.assert 39 | window.expect = window.chai.expect 40 | -------------------------------------------------------------------------------- /document-sign-demo/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test", 3 | "version": "0.20.4", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "crypto-js": { 8 | "version": "3.1.8", 9 | "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.8.tgz", 10 | "integrity": "sha1-cV8HC/YBTyrpkqmLOSkli3E/CNU=" 11 | }, 12 | "utf8": { 13 | "version": "2.1.2", 14 | "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.2.tgz", 15 | "integrity": "sha1-H6DZJw6b6FDZsFAn9jUZv0ZFfZY=" 16 | }, 17 | "web3": { 18 | "version": "0.20.4", 19 | "resolved": "https://registry.npmjs.org/web3/-/web3-0.20.4.tgz", 20 | "integrity": "sha1-QA5leaZbtKPd5xpuv2UJr63DOgQ=", 21 | "requires": { 22 | "bignumber.js": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934", 23 | "crypto-js": "3.1.8", 24 | "utf8": "2.1.2", 25 | "xhr2": "0.1.4", 26 | "xmlhttprequest": "1.8.0" 27 | }, 28 | "dependencies": { 29 | "bignumber.js": { 30 | "version": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934" 31 | } 32 | } 33 | }, 34 | "xhr2": { 35 | "version": "0.1.4", 36 | "resolved": "https://registry.npmjs.org/xhr2/-/xhr2-0.1.4.tgz", 37 | "integrity": "sha1-f4dliEdxbbUCYyOBL4GMras4el8=" 38 | }, 39 | "xmlhttprequest": { 40 | "version": "1.8.0", 41 | "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", 42 | "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=" 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/bignumber.js/perf/lib/bigdecimal_GWT/BigDecTest.java: -------------------------------------------------------------------------------- 1 | // javac BigDecTest.java 2 | // java BigDecTest 3 | 4 | import java.math.BigDecimal; 5 | 6 | public class BigDecTest 7 | { 8 | public static void main(String[] args) { 9 | 10 | int i; 11 | BigDecimal x, y, r; 12 | 13 | // remainder 14 | 15 | x = new BigDecimal("9.785496E-2"); 16 | y = new BigDecimal("-5.9219189762E-2"); 17 | r = x.remainder(y); 18 | System.out.println( r.toString() ); 19 | // 0.038635770238 20 | 21 | 22 | x = new BigDecimal("1.23693014661017964112E-5"); 23 | y = new BigDecimal("-6.9318042E-7"); 24 | r = x.remainder(y); 25 | System.out.println( r.toPlainString() ); 26 | // 0.0000005852343261017964112 27 | 28 | 29 | // divide 30 | 31 | x = new BigDecimal("6.9609119610E-78"); 32 | y = new BigDecimal("4E-48"); 33 | r = x.divide(y, 40, 6); // ROUND_HALF_EVEN 34 | System.out.println( r.toString() ); 35 | // 1.7402279902E-30 36 | 37 | 38 | x = new BigDecimal("5.383458817E-83"); 39 | y = new BigDecimal("8E-54"); 40 | r = x.divide(y, 40, 6); 41 | System.out.println( r.toString() ); 42 | // 6.7293235212E-30 43 | 44 | 45 | // compareTo 46 | 47 | x = new BigDecimal("0.04"); 48 | y = new BigDecimal("0.079393068"); 49 | i = x.compareTo(y); 50 | System.out.println(i); 51 | // -1 52 | 53 | x = new BigDecimal("7.88749578569876987785987658649E-10"); 54 | y = new BigDecimal("4.2545098709E-6"); 55 | i = x.compareTo(y); 56 | System.out.println(i); 57 | // -1 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/mode-ctr.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * Counter block mode. 18 | */ 19 | CryptoJS.mode.CTR = (function () { 20 | var CTR = CryptoJS.lib.BlockCipherMode.extend(); 21 | 22 | var Encryptor = CTR.Encryptor = CTR.extend({ 23 | processBlock: function (words, offset) { 24 | // Shortcuts 25 | var cipher = this._cipher 26 | var blockSize = cipher.blockSize; 27 | var iv = this._iv; 28 | var counter = this._counter; 29 | 30 | // Generate keystream 31 | if (iv) { 32 | counter = this._counter = iv.slice(0); 33 | 34 | // Remove IV for subsequent blocks 35 | this._iv = undefined; 36 | } 37 | var keystream = counter.slice(0); 38 | cipher.encryptBlock(keystream, 0); 39 | 40 | // Increment counter 41 | counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0 42 | 43 | // Encrypt 44 | for (var i = 0; i < blockSize; i++) { 45 | words[offset + i] ^= keystream[i]; 46 | } 47 | } 48 | }); 49 | 50 | CTR.Decryptor = Encryptor; 51 | 52 | return CTR; 53 | }()); 54 | 55 | 56 | return CryptoJS.mode.CTR; 57 | 58 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/mode-ctr.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * Counter block mode. 18 | */ 19 | CryptoJS.mode.CTR = (function () { 20 | var CTR = CryptoJS.lib.BlockCipherMode.extend(); 21 | 22 | var Encryptor = CTR.Encryptor = CTR.extend({ 23 | processBlock: function (words, offset) { 24 | // Shortcuts 25 | var cipher = this._cipher 26 | var blockSize = cipher.blockSize; 27 | var iv = this._iv; 28 | var counter = this._counter; 29 | 30 | // Generate keystream 31 | if (iv) { 32 | counter = this._counter = iv.slice(0); 33 | 34 | // Remove IV for subsequent blocks 35 | this._iv = undefined; 36 | } 37 | var keystream = counter.slice(0); 38 | cipher.encryptBlock(keystream, 0); 39 | 40 | // Increment counter 41 | counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0 42 | 43 | // Encrypt 44 | for (var i = 0; i < blockSize; i++) { 45 | words[offset + i] ^= keystream[i]; 46 | } 47 | } 48 | }); 49 | 50 | CTR.Decryptor = Encryptor; 51 | 52 | return CTR; 53 | }()); 54 | 55 | 56 | return CryptoJS.mode.CTR; 57 | 58 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_args": [ 3 | [ 4 | "crypto-js@3.1.8", 5 | "C:\\Temp\\0-Blockchain\\MPA" 6 | ] 7 | ], 8 | "_from": "crypto-js@3.1.8", 9 | "_id": "crypto-js@3.1.8", 10 | "_inBundle": false, 11 | "_integrity": "sha1-cV8HC/YBTyrpkqmLOSkli3E/CNU=", 12 | "_location": "/crypto-js", 13 | "_phantomChildren": {}, 14 | "_requested": { 15 | "type": "version", 16 | "registry": true, 17 | "raw": "crypto-js@3.1.8", 18 | "name": "crypto-js", 19 | "escapedName": "crypto-js", 20 | "rawSpec": "3.1.8", 21 | "saveSpec": null, 22 | "fetchSpec": "3.1.8" 23 | }, 24 | "_requiredBy": [ 25 | "/web3" 26 | ], 27 | "_resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.8.tgz", 28 | "_spec": "3.1.8", 29 | "_where": "C:\\Temp\\0-Blockchain\\MPA", 30 | "author": { 31 | "name": "Evan Vosberg", 32 | "url": "http://github.com/evanvosberg" 33 | }, 34 | "bugs": { 35 | "url": "https://github.com/brix/crypto-js/issues" 36 | }, 37 | "dependencies": {}, 38 | "description": "JavaScript library of crypto standards.", 39 | "homepage": "http://github.com/brix/crypto-js", 40 | "keywords": [ 41 | "security", 42 | "crypto", 43 | "Hash", 44 | "MD5", 45 | "SHA1", 46 | "SHA-1", 47 | "SHA256", 48 | "SHA-256", 49 | "RC4", 50 | "Rabbit", 51 | "AES", 52 | "DES", 53 | "PBKDF2", 54 | "HMAC", 55 | "OFB", 56 | "CFB", 57 | "CTR", 58 | "CBC", 59 | "Base64" 60 | ], 61 | "license": "MIT", 62 | "main": "index.js", 63 | "name": "crypto-js", 64 | "repository": { 65 | "type": "git", 66 | "url": "git+ssh://git@github.com/brix/crypto-js.git" 67 | }, 68 | "version": "3.1.8" 69 | } 70 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/web3/methods/net.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of web3.js. 3 | 4 | web3.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | web3.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with web3.js. If not, see . 16 | */ 17 | /** @file eth.js 18 | * @authors: 19 | * Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | var utils = require('../../utils/utils'); 24 | var Property = require('../property'); 25 | 26 | var Net = function (web3) { 27 | this._requestManager = web3._requestManager; 28 | 29 | var self = this; 30 | 31 | properties().forEach(function(p) { 32 | p.attachToObject(self); 33 | p.setRequestManager(web3._requestManager); 34 | }); 35 | }; 36 | 37 | /// @returns an array of objects describing web3.eth api properties 38 | var properties = function () { 39 | return [ 40 | new Property({ 41 | name: 'listening', 42 | getter: 'net_listening' 43 | }), 44 | new Property({ 45 | name: 'peerCount', 46 | getter: 'net_peerCount', 47 | outputFormatter: utils.toDecimal 48 | }) 49 | ]; 50 | }; 51 | 52 | module.exports = Net; 53 | -------------------------------------------------------------------------------- /document-sign-demo/smartcontracts/Vessel.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.18; 2 | 3 | import "./BuilderCert.sol"; 4 | import "./ClassCert.sol"; 5 | import "./TonnageCert.sol"; 6 | 7 | contract Vessel { 8 | mapping (uint32 => address) builderCerts; 9 | mapping (uint32 => address) classCerts; 10 | mapping(uint32 => address) tonnageCerts; 11 | 12 | function Vessel () { 13 | } 14 | 15 | function NewBuilderCert(uint32 imo) public payable { 16 | BuilderCert builderCert; 17 | builderCert = new BuilderCert(); 18 | builderCerts[imo] = address(builderCert); 19 | builderCert.UpdateInformation("", imo, 20 | 0, 21 | "", 22 | "", 23 | "", 24 | "", 25 | 0, 26 | 0, 27 | ""); 28 | } 29 | 30 | //function GetBuildCert() public view returns (address, string) { 31 | function GetBuildCert(uint32 imo) public returns (address) { 32 | return builderCerts[imo]; 33 | } 34 | 35 | function NewClassCert(uint32 imo) public payable { 36 | ClassCert cert; 37 | cert = new ClassCert(); 38 | classCerts[imo] = address(cert); 39 | cert.UpdateInformation("", 40 | imo, 41 | "", 42 | "", 43 | 0, 44 | 0, 45 | "", 46 | ""); 47 | } 48 | 49 | function GetClassCert(uint32 imo) public returns (address) { 50 | return classCerts[imo]; 51 | } 52 | 53 | function NewTonnageCert(uint32 imo) public payable { 54 | TonnageCert cert; 55 | cert = new TonnageCert(); 56 | tonnageCerts[imo] = address(cert); 57 | 58 | cert.UpdateInformation("", 59 | imo, 60 | 0, 61 | 0, 62 | 0, 63 | "", 64 | 0, 65 | "", 66 | ""); 67 | } 68 | 69 | function GetTonnageCert(uint32 imo) public returns (address) { 70 | return tonnageCerts[imo]; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/utf8/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_args": [ 3 | [ 4 | "utf8@2.1.2", 5 | "C:\\Temp\\0-Blockchain\\MPA" 6 | ] 7 | ], 8 | "_from": "utf8@2.1.2", 9 | "_id": "utf8@2.1.2", 10 | "_inBundle": false, 11 | "_integrity": "sha1-H6DZJw6b6FDZsFAn9jUZv0ZFfZY=", 12 | "_location": "/utf8", 13 | "_phantomChildren": {}, 14 | "_requested": { 15 | "type": "version", 16 | "registry": true, 17 | "raw": "utf8@2.1.2", 18 | "name": "utf8", 19 | "escapedName": "utf8", 20 | "rawSpec": "2.1.2", 21 | "saveSpec": null, 22 | "fetchSpec": "2.1.2" 23 | }, 24 | "_requiredBy": [ 25 | "/web3" 26 | ], 27 | "_resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.2.tgz", 28 | "_spec": "2.1.2", 29 | "_where": "C:\\Temp\\0-Blockchain\\MPA", 30 | "author": { 31 | "name": "Mathias Bynens", 32 | "url": "https://mathiasbynens.be/" 33 | }, 34 | "bugs": { 35 | "url": "https://github.com/mathiasbynens/utf8.js/issues" 36 | }, 37 | "description": "A well-tested UTF-8 encoder/decoder written in JavaScript.", 38 | "devDependencies": { 39 | "coveralls": "^2.11.14", 40 | "grunt": "^1.0.1", 41 | "grunt-shell": "^1.1.2", 42 | "istanbul": "^0.4.5", 43 | "qunit-extras": "^1.4.2", 44 | "qunitjs": "~1.11.0", 45 | "requirejs": "^2.3.2" 46 | }, 47 | "files": [ 48 | "LICENSE-MIT.txt", 49 | "utf8.js" 50 | ], 51 | "homepage": "https://mths.be/utf8js", 52 | "keywords": [ 53 | "charset", 54 | "encoding", 55 | "unicode", 56 | "utf8" 57 | ], 58 | "license": "MIT", 59 | "main": "utf8.js", 60 | "name": "utf8", 61 | "repository": { 62 | "type": "git", 63 | "url": "git+https://github.com/mathiasbynens/utf8.js.git" 64 | }, 65 | "scripts": { 66 | "test": "node tests/tests.js" 67 | }, 68 | "version": "2.1.2" 69 | } 70 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/test/src/status_test.coffee: -------------------------------------------------------------------------------- 1 | describe 'XMLHttpRequest', -> 2 | beforeEach -> 3 | @xhr = new XMLHttpRequest 4 | @okUrl = 'http://localhost:8912/test/fixtures/hello.txt' 5 | 6 | @errorUrl = 'http://localhost:8912/_/response' 7 | @errorJson = JSON.stringify 8 | code: 401, status: 'Unauthorized', 9 | body: JSON.stringify(error: 'Credential error'), 10 | headers: 11 | 'Content-Type': 'application/json', 'Content-Length': '28' 12 | 13 | describe '#status', -> 14 | it 'is 200 for a normal request', (done) -> 15 | @xhr.open 'GET', @okUrl 16 | _done = false 17 | @xhr.addEventListener 'readystatechange', => 18 | return if _done 19 | if @xhr.readyState < XMLHttpRequest.HEADERS_RECEIVED 20 | expect(@xhr.status).to.equal 0 21 | expect(@xhr.statusText).to.equal '' 22 | else 23 | expect(@xhr.status).to.equal 200 24 | expect(@xhr.statusText).to.be.ok 25 | expect(@xhr.statusText).to.not.equal '' 26 | if @xhr.readyState is XMLHttpRequest.DONE 27 | _done = true 28 | done() 29 | @xhr.send() 30 | 31 | it 'returns the server-reported status', (done) -> 32 | @xhr.open 'POST', @errorUrl 33 | _done = false 34 | @xhr.addEventListener 'readystatechange', => 35 | return if _done 36 | if @xhr.readyState < XMLHttpRequest.HEADERS_RECEIVED 37 | expect(@xhr.status).to.equal 0 38 | expect(@xhr.statusText).to.equal '' 39 | else 40 | expect(@xhr.status).to.equal 401 41 | expect(@xhr.statusText).to.be.ok 42 | expect(@xhr.statusText).to.not.equal '' 43 | if @xhr.readyState is XMLHttpRequest.DONE 44 | _done = true 45 | done() 46 | @xhr.send @errorJson 47 | 48 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/web3/errors.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of web3.js. 3 | 4 | web3.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | web3.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with web3.js. If not, see . 16 | */ 17 | /** 18 | * @file errors.js 19 | * @author Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | module.exports = { 24 | InvalidNumberOfSolidityArgs: function () { 25 | return new Error('Invalid number of arguments to Solidity function'); 26 | }, 27 | InvalidNumberOfRPCParams: function () { 28 | return new Error('Invalid number of input parameters to RPC method'); 29 | }, 30 | InvalidConnection: function (host){ 31 | return new Error('CONNECTION ERROR: Couldn\'t connect to node '+ host +'.'); 32 | }, 33 | InvalidProvider: function () { 34 | return new Error('Provider not set or invalid'); 35 | }, 36 | InvalidResponse: function (result){ 37 | var message = !!result && !!result.error && !!result.error.message ? result.error.message : 'Invalid JSON RPC response: ' + JSON.stringify(result); 38 | return new Error(message); 39 | }, 40 | ConnectionTimeout: function (ms){ 41 | return new Error('CONNECTION TIMEOUT: timeout of ' + ms + ' ms achived'); 42 | } 43 | }; 44 | -------------------------------------------------------------------------------- /document-sign-demo/test-truffle-builder.js: -------------------------------------------------------------------------------- 1 | /* 2 | Below scripts are to be running in truffle console environment. 3 | */ 4 | 5 | var txnUrl = 'http://:8545'; 6 | web3.setProvider(new web3.providers.HttpProvider(txnUrl)); 7 | web3.personal.unlockAccount(web3.eth.accounts[0],''); 8 | var contractAddress = '0x834801908759c80cb9650aa96a4bf40162d7caad'; 9 | var fs = require('fs'); 10 | var abiArray = fs.readFileSync('./build/contracts/BuilderCert.json','utf-8'); 11 | var abi = JSON.parse(abiArray); 12 | var contract = web3.eth.contract(abi.abi).new({from:web3.eth.accounts[0], gas:3000000, data:abi.bytecode}); 13 | 14 | var today = (new Date()); 15 | var opt = {from:web3.eth.accounts[0], gas:3000000}; 16 | var expiry = (new Date( today.getFullYear() + 1, today.getMonth(), today.getDate() )); 17 | 18 | 19 | /*=============================*/ 20 | //var admin = web3.eth.accounts[0]; 21 | //var option = {from:admin}; 22 | //var gasValue = contract.UpdateInformation.estimateGas('Name of the Ship',10000,10000,'Owner Name 3','Owner Address', 'Designation' ,'POA' ,today.getTime(),expiry.getTime(),'Shipyard address', option); 23 | //option.gas = gasValue; 24 | //var hash = contract.UpdateInformation.sendTransaction('Name of the Ship',1,1,'Owner Name','Owner Address', 'Designation' ,'POA' ,today.getTime(),expiry.getTime(),'Shipyard address', option); 25 | /*=============================*/ 26 | var hash = contract.New 27 | //!!! Check Contract.Address to confirm it is mined by running contract.address to check if it is 'undefined' !!! 28 | var hash = contract.UpdateInformation.sendTransaction('Name of the Ship',1,1,'Owner Name','Owner Address', 'Designation' ,'POA' ,today.getTime(),expiry.getTime(),'Shipyard address', opt); 29 | var result = web3.eth.getTransactionReceipt(hash); 30 | var resp = web3.eth.contract(abi.abi).at(result.to); 31 | resp.ShipownerName.call(); 32 | resp.IMO.call().toString(); 33 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/web3/methods/db.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of web3.js. 3 | 4 | web3.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | web3.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with web3.js. If not, see . 16 | */ 17 | /** @file db.js 18 | * @authors: 19 | * Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | var Method = require('../method'); 24 | 25 | var DB = function (web3) { 26 | this._requestManager = web3._requestManager; 27 | 28 | var self = this; 29 | 30 | methods().forEach(function(method) { 31 | method.attachToObject(self); 32 | method.setRequestManager(web3._requestManager); 33 | }); 34 | }; 35 | 36 | var methods = function () { 37 | var putString = new Method({ 38 | name: 'putString', 39 | call: 'db_putString', 40 | params: 3 41 | }); 42 | 43 | var getString = new Method({ 44 | name: 'getString', 45 | call: 'db_getString', 46 | params: 2 47 | }); 48 | 49 | var putHex = new Method({ 50 | name: 'putHex', 51 | call: 'db_putHex', 52 | params: 3 53 | }); 54 | 55 | var getHex = new Method({ 56 | name: 'getHex', 57 | call: 'db_getHex', 58 | params: 2 59 | }); 60 | 61 | return [ 62 | putString, getString, putHex, getHex 63 | ]; 64 | }; 65 | 66 | module.exports = DB; 67 | -------------------------------------------------------------------------------- /smartcontractClient/nodeapp/smartContractClient.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var tx = 'http://{TX Node IP}:8545'; 3 | var passpharse = '{Password}'; 4 | var fs = require('fs'); 5 | var Web3 = require('web3'); 6 | var web3 = new Web3(); 7 | var address5 = '0x2ed795cdff952c6f00a34d6c3ca81344cfcf850bb838fa5a4fb28c72af9b7ef0';//deployed contract address 8 | var text = fs.readFileSync('./contracts/ChickenFarmContract5.json','utf8');//truffle compile result 9 | 10 | 11 | web3.setProvider(new web3.providers.HttpProvider(tx)); 12 | 13 | //unlock accounts that we'll be using 14 | web3.personal.unlockAccount(web3.eth.accounts[0],passpharse); 15 | //load contract 16 | var contractInterface = JSON.parse(text); 17 | //deploy the contract with constructor parameters, we need to supply gas so that the contract can be deployed 18 | var cf3 = web3.eth.contract(contractInterface.abi).new('test123','test456',{from:web3.eth.accounts[0],data:contractInterface.unlinked_binary,gas:3000000}); 19 | //the contract will need to be mined, we get transaction hash here to check if it is mined 20 | console.log('cf3.transactionHash:' + cf3.transactionHash); 21 | 22 | 23 | function waitForTransactionReceipt(hash) { 24 | console.log('waiting for contract to be mined'); 25 | const receipt = web3.eth.getTransactionReceipt(hash); 26 | // If no receipt, try again in 1s 27 | if (receipt == null) { 28 | setTimeout(() => { 29 | waitForTransactionReceipt(hash); 30 | }, 1000); 31 | } else { 32 | // The transaction was mined, we can retrieve the contract address 33 | console.log('contract address: ' + receipt.contractAddress); 34 | var result2 = cf3.UpdateContract.sendTransaction('newState',1,{from:web3.eth.accounts[0]}); 35 | console.log('receipt=' + receipt); 36 | console.log('cf3=' + cf3); 37 | console.log('result=' + result2); 38 | } 39 | } 40 | 41 | //wait till transaciton mined 42 | waitForTransactionReceipt(cf3.transactionHash); 43 | 44 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/utils/config.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of web3.js. 3 | 4 | web3.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | web3.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with web3.js. If not, see . 16 | */ 17 | /** @file config.js 18 | * @authors: 19 | * Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | /** 24 | * Utils 25 | * 26 | * @module utils 27 | */ 28 | 29 | /** 30 | * Utility functions 31 | * 32 | * @class [utils] config 33 | * @constructor 34 | */ 35 | 36 | 37 | /// required to define ETH_BIGNUMBER_ROUNDING_MODE 38 | var BigNumber = require('bignumber.js'); 39 | 40 | var ETH_UNITS = [ 41 | 'wei', 42 | 'kwei', 43 | 'Mwei', 44 | 'Gwei', 45 | 'szabo', 46 | 'finney', 47 | 'femtoether', 48 | 'picoether', 49 | 'nanoether', 50 | 'microether', 51 | 'milliether', 52 | 'nano', 53 | 'micro', 54 | 'milli', 55 | 'ether', 56 | 'grand', 57 | 'Mether', 58 | 'Gether', 59 | 'Tether', 60 | 'Pether', 61 | 'Eether', 62 | 'Zether', 63 | 'Yether', 64 | 'Nether', 65 | 'Dether', 66 | 'Vether', 67 | 'Uether' 68 | ]; 69 | 70 | module.exports = { 71 | ETH_PADDING: 32, 72 | ETH_SIGNATURE_LENGTH: 4, 73 | ETH_UNITS: ETH_UNITS, 74 | ETH_BIGNUMBER_ROUNDING_MODE: { ROUNDING_MODE: BigNumber.ROUND_DOWN }, 75 | ETH_POLLING_TIMEOUT: 1000/2, 76 | defaultBlock: 'latest', 77 | defaultAccount: undefined 78 | }; 79 | 80 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/packages/web3-providers-ws/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "requires": true, 3 | "lockfileVersion": 1, 4 | "dependencies": { 5 | "debug": { 6 | "version": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", 7 | "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", 8 | "requires": { 9 | "ms": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz" 10 | } 11 | }, 12 | "is-typedarray": { 13 | "version": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", 14 | "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" 15 | }, 16 | "ms": { 17 | "version": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 18 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 19 | }, 20 | "nan": { 21 | "version": "https://registry.npmjs.org/nan/-/nan-2.6.2.tgz", 22 | "integrity": "sha1-5P805slf37WuzAjeZZb0NgWn20U=" 23 | }, 24 | "typedarray-to-buffer": { 25 | "version": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.2.tgz", 26 | "integrity": "sha1-EBezLZhP9VbroQD1AViauhrOLgQ=", 27 | "requires": { 28 | "is-typedarray": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz" 29 | } 30 | }, 31 | "underscore": { 32 | "version": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", 33 | "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" 34 | }, 35 | "websocket": { 36 | "version": "git://github.com/frozeman/WebSocket-Node.git#7004c39c42ac98875ab61126e5b4a925430f592c", 37 | "integrity": "sha1-Go9Vp4DqhRFzZ8Pf9JJ1MWyrCps=", 38 | "requires": { 39 | "debug": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", 40 | "nan": "https://registry.npmjs.org/nan/-/nan-2.6.2.tgz", 41 | "typedarray-to-buffer": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.2.tgz", 42 | "yaeti": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz" 43 | } 44 | }, 45 | "yaeti": { 46 | "version": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", 47 | "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/format-hex.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function (undefined) { 17 | // Shortcuts 18 | var C = CryptoJS; 19 | var C_lib = C.lib; 20 | var CipherParams = C_lib.CipherParams; 21 | var C_enc = C.enc; 22 | var Hex = C_enc.Hex; 23 | var C_format = C.format; 24 | 25 | var HexFormatter = C_format.Hex = { 26 | /** 27 | * Converts the ciphertext of a cipher params object to a hexadecimally encoded string. 28 | * 29 | * @param {CipherParams} cipherParams The cipher params object. 30 | * 31 | * @return {string} The hexadecimally encoded string. 32 | * 33 | * @static 34 | * 35 | * @example 36 | * 37 | * var hexString = CryptoJS.format.Hex.stringify(cipherParams); 38 | */ 39 | stringify: function (cipherParams) { 40 | return cipherParams.ciphertext.toString(Hex); 41 | }, 42 | 43 | /** 44 | * Converts a hexadecimally encoded ciphertext string to a cipher params object. 45 | * 46 | * @param {string} input The hexadecimally encoded string. 47 | * 48 | * @return {CipherParams} The cipher params object. 49 | * 50 | * @static 51 | * 52 | * @example 53 | * 54 | * var cipherParams = CryptoJS.format.Hex.parse(hexString); 55 | */ 56 | parse: function (input) { 57 | var ciphertext = Hex.parse(input); 58 | return CipherParams.create({ ciphertext: ciphertext }); 59 | } 60 | }; 61 | }()); 62 | 63 | 64 | return CryptoJS.format.Hex; 65 | 66 | })); -------------------------------------------------------------------------------- /oracle/smartcontracts/OracleApp4.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.10; 2 | 3 | import "./OracleContract4.sol"; 4 | import "./OracleResolver4.sol"; 5 | 6 | //my client contract 7 | contract OracleApp4 { 8 | OracleResolver4 public resolver; 9 | OracleContract4 public oracle; 10 | 11 | function OracleApp4() { 12 | resolver = OracleResolver4(0x444078Aa15FE48B152245744cBD16023B2444C0e);//change the address to your OracleResolver.sol checksum address 13 | resolver.setOracleAddress(0x08c152C90F2775915B1EBC88C218A9B86307A775);//change the address to your Oracle.sol checksum address 14 | oracle = OracleContract4(resolver.getOracleAddress()); 15 | } 16 | 17 | modifier myOracleAPI { 18 | _; 19 | } 20 | 21 | modifier onlyFromCallback { 22 | require(msg.sender == oracle.callbackAddress()); 23 | _; 24 | } 25 | 26 | function queryOracle(string _query) internal myOracleAPI returns(bytes32 id) { 27 | return oracle.query(_query); 28 | } 29 | 30 | function _callback(bytes32 _id, string result) onlyFromCallback { 31 | //callback function for offchain to call back 32 | 33 | } 34 | } 35 | 36 | contract myClientContract4 is OracleApp4 { 37 | address owner; 38 | string public key; 39 | string public state; 40 | bytes32 id; 41 | event OnCallBack(bytes32 __id, string __result); 42 | // override 43 | function _callback(bytes32 _id, string result) onlyFromCallback { 44 | state = result; 45 | OnCallBack(_id, result); 46 | } 47 | function updateContract(string _state) myOracleAPI { 48 | state = _state; 49 | queryOracle(_state); 50 | } 51 | function updateContract2(string _state) myOracleAPI { 52 | state = _state; 53 | } 54 | function updateContract3(string _state) myOracleAPI { 55 | oracle.query(_state); 56 | state = _state; 57 | } 58 | function updateContract4(string _state) myOracleAPI { 59 | oracle.query(_state); 60 | } 61 | function updateContract5() myOracleAPI returns (uint) { 62 | return oracle.getRandomNumber(); 63 | } 64 | } -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/format-hex.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function (undefined) { 17 | // Shortcuts 18 | var C = CryptoJS; 19 | var C_lib = C.lib; 20 | var CipherParams = C_lib.CipherParams; 21 | var C_enc = C.enc; 22 | var Hex = C_enc.Hex; 23 | var C_format = C.format; 24 | 25 | var HexFormatter = C_format.Hex = { 26 | /** 27 | * Converts the ciphertext of a cipher params object to a hexadecimally encoded string. 28 | * 29 | * @param {CipherParams} cipherParams The cipher params object. 30 | * 31 | * @return {string} The hexadecimally encoded string. 32 | * 33 | * @static 34 | * 35 | * @example 36 | * 37 | * var hexString = CryptoJS.format.Hex.stringify(cipherParams); 38 | */ 39 | stringify: function (cipherParams) { 40 | return cipherParams.ciphertext.toString(Hex); 41 | }, 42 | 43 | /** 44 | * Converts a hexadecimally encoded ciphertext string to a cipher params object. 45 | * 46 | * @param {string} input The hexadecimally encoded string. 47 | * 48 | * @return {CipherParams} The cipher params object. 49 | * 50 | * @static 51 | * 52 | * @example 53 | * 54 | * var cipherParams = CryptoJS.format.Hex.parse(hexString); 55 | */ 56 | parse: function (input) { 57 | var ciphertext = Hex.parse(input); 58 | return CipherParams.create({ ciphertext: ciphertext }); 59 | } 60 | }; 61 | }()); 62 | 63 | 64 | return CryptoJS.format.Hex; 65 | 66 | })); -------------------------------------------------------------------------------- /document-sign-demo/smartcontracts/TonnageCert.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.18; 2 | 3 | contract TonnageCert { 4 | /* 5 | ○ GT=>gross tonnage (number, unit : Tons) 6 | ○ NT -> Wet Tonnage (Number => Tons) 7 | ○ Length (Numbers => meter, up to 2 decimal points) 8 | ○ Breadth (Number => meter) 9 | ○ Depth (Number => meter) 10 | ○ Vessel name (Ship name) 11 | ○ IMO Number (Ship number) or Official Number 12 | ○ Class Name 13 | ○ Issue Date 14 | Date of expiry 15 | */ 16 | string public Version = "V1.0-2018-01-24"; 17 | uint32 public Length = 0; 18 | uint32 public Breadth = 0; 19 | uint32 public Depth = 0; 20 | string public NameOfShip = ""; 21 | string public ClassName = ""; 22 | uint public DateOfIssue = 0; 23 | uint32 public IMO = 0; 24 | string public GT; 25 | string public NT; 26 | 27 | function TonnageCert() { 28 | 29 | } 30 | 31 | function stringsEqual(string memory _a, string memory _b) returns (bool) { 32 | bytes memory a = bytes(_a); 33 | bytes memory b = bytes(_b); 34 | if (a.length != b.length) { 35 | return false; 36 | } 37 | 38 | for (uint i = 0; i < a.length; i ++) { 39 | if (a[i] != b[i]) 40 | return false; 41 | } 42 | return true; 43 | } 44 | 45 | function UpdateInformation (string _NameOfShip, 46 | uint32 _IMO, 47 | uint32 _Length, 48 | uint32 _Breadth, 49 | uint32 _Depth, 50 | string _ClassName, 51 | uint _DateOfIssue, 52 | string _GT, 53 | string _NT) public payable 54 | { 55 | NameOfShip = _NameOfShip; 56 | IMO = _IMO; 57 | Length = _Length; 58 | Breadth = _Breadth; 59 | Depth = _Depth; 60 | ClassName = _ClassName; 61 | DateOfIssue = _DateOfIssue; 62 | GT = _GT; 63 | NT = _NT; 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xmlhttprequest/README.md: -------------------------------------------------------------------------------- 1 | # node-XMLHttpRequest # 2 | 3 | node-XMLHttpRequest is a wrapper for the built-in http client to emulate the 4 | browser XMLHttpRequest object. 5 | 6 | This can be used with JS designed for browsers to improve reuse of code and 7 | allow the use of existing libraries. 8 | 9 | Note: This library currently conforms to [XMLHttpRequest 1](http://www.w3.org/TR/XMLHttpRequest/). Version 2.0 will target [XMLHttpRequest Level 2](http://www.w3.org/TR/XMLHttpRequest2/). 10 | 11 | ## Usage ## 12 | 13 | Here's how to include the module in your project and use as the browser-based 14 | XHR object. 15 | 16 | var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; 17 | var xhr = new XMLHttpRequest(); 18 | 19 | Note: use the lowercase string "xmlhttprequest" in your require(). On 20 | case-sensitive systems (eg Linux) using uppercase letters won't work. 21 | 22 | ## Versions ## 23 | 24 | Prior to 1.4.0 version numbers were arbitrary. From 1.4.0 on they conform to 25 | the standard major.minor.bugfix. 1.x shouldn't necessarily be considered 26 | stable just because it's above 0.x. 27 | 28 | Since the XMLHttpRequest API is stable this library's API is stable as 29 | well. Major version numbers indicate significant core code changes. 30 | Minor versions indicate minor core code changes or better conformity to 31 | the W3C spec. 32 | 33 | ## License ## 34 | 35 | MIT license. See LICENSE for full details. 36 | 37 | ## Supports ## 38 | 39 | * Async and synchronous requests 40 | * GET, POST, PUT, and DELETE requests 41 | * All spec methods (open, send, abort, getRequestHeader, 42 | getAllRequestHeaders, event methods) 43 | * Requests to all domains 44 | 45 | ## Known Issues / Missing Features ## 46 | 47 | For a list of open issues or to report your own visit the [github issues 48 | page](https://github.com/driverdan/node-XMLHttpRequest/issues). 49 | 50 | * Local file access may have unexpected results for non-UTF8 files 51 | * Synchronous requests don't set headers properly 52 | * Synchronous requests freeze node while waiting for response (But that's what you want, right? Stick with async!). 53 | * Some events are missing, such as abort 54 | * Cookies aren't persisted between requests 55 | * Missing XML support 56 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/web3/batch.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of web3.js. 3 | 4 | web3.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | web3.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with web3.js. If not, see . 16 | */ 17 | /** 18 | * @file batch.js 19 | * @author Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | var Jsonrpc = require('./jsonrpc'); 24 | var errors = require('./errors'); 25 | 26 | var Batch = function (web3) { 27 | this.requestManager = web3._requestManager; 28 | this.requests = []; 29 | }; 30 | 31 | /** 32 | * Should be called to add create new request to batch request 33 | * 34 | * @method add 35 | * @param {Object} jsonrpc requet object 36 | */ 37 | Batch.prototype.add = function (request) { 38 | this.requests.push(request); 39 | }; 40 | 41 | /** 42 | * Should be called to execute batch request 43 | * 44 | * @method execute 45 | */ 46 | Batch.prototype.execute = function () { 47 | var requests = this.requests; 48 | this.requestManager.sendBatch(requests, function (err, results) { 49 | results = results || []; 50 | requests.map(function (request, index) { 51 | return results[index] || {}; 52 | }).forEach(function (result, index) { 53 | if (requests[index].callback) { 54 | 55 | if (!Jsonrpc.isValidResponse(result)) { 56 | return requests[index].callback(errors.InvalidResponse(result)); 57 | } 58 | 59 | requests[index].callback(null, (requests[index].format ? requests[index].format(result.result) : result.result)); 60 | } 61 | }); 62 | }); 63 | }; 64 | 65 | module.exports = Batch; 66 | 67 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/sha224.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./sha256")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./sha256"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function () { 17 | // Shortcuts 18 | var C = CryptoJS; 19 | var C_lib = C.lib; 20 | var WordArray = C_lib.WordArray; 21 | var C_algo = C.algo; 22 | var SHA256 = C_algo.SHA256; 23 | 24 | /** 25 | * SHA-224 hash algorithm. 26 | */ 27 | var SHA224 = C_algo.SHA224 = SHA256.extend({ 28 | _doReset: function () { 29 | this._hash = new WordArray.init([ 30 | 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 31 | 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 32 | ]); 33 | }, 34 | 35 | _doFinalize: function () { 36 | var hash = SHA256._doFinalize.call(this); 37 | 38 | hash.sigBytes -= 4; 39 | 40 | return hash; 41 | } 42 | }); 43 | 44 | /** 45 | * Shortcut function to the hasher's object interface. 46 | * 47 | * @param {WordArray|string} message The message to hash. 48 | * 49 | * @return {WordArray} The hash. 50 | * 51 | * @static 52 | * 53 | * @example 54 | * 55 | * var hash = CryptoJS.SHA224('message'); 56 | * var hash = CryptoJS.SHA224(wordArray); 57 | */ 58 | C.SHA224 = SHA256._createHelper(SHA224); 59 | 60 | /** 61 | * Shortcut function to the HMAC's object interface. 62 | * 63 | * @param {WordArray|string} message The message to hash. 64 | * @param {WordArray|string} key The secret key. 65 | * 66 | * @return {WordArray} The HMAC. 67 | * 68 | * @static 69 | * 70 | * @example 71 | * 72 | * var hmac = CryptoJS.HmacSHA224(message, key); 73 | */ 74 | C.HmacSHA224 = SHA256._createHmacHelper(SHA224); 75 | }()); 76 | 77 | 78 | return CryptoJS.SHA224; 79 | 80 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/contracts/ICAPRegistrar.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "constant": true, 4 | "inputs": [ 5 | { 6 | "name": "_name", 7 | "type": "bytes32" 8 | } 9 | ], 10 | "name": "owner", 11 | "outputs": [ 12 | { 13 | "name": "", 14 | "type": "address" 15 | } 16 | ], 17 | "type": "function" 18 | }, 19 | { 20 | "constant": false, 21 | "inputs": [ 22 | { 23 | "name": "_name", 24 | "type": "bytes32" 25 | }, 26 | { 27 | "name": "_refund", 28 | "type": "address" 29 | } 30 | ], 31 | "name": "disown", 32 | "outputs": [], 33 | "type": "function" 34 | }, 35 | { 36 | "constant": true, 37 | "inputs": [ 38 | { 39 | "name": "_name", 40 | "type": "bytes32" 41 | } 42 | ], 43 | "name": "addr", 44 | "outputs": [ 45 | { 46 | "name": "", 47 | "type": "address" 48 | } 49 | ], 50 | "type": "function" 51 | }, 52 | { 53 | "constant": false, 54 | "inputs": [ 55 | { 56 | "name": "_name", 57 | "type": "bytes32" 58 | } 59 | ], 60 | "name": "reserve", 61 | "outputs": [], 62 | "type": "function" 63 | }, 64 | { 65 | "constant": false, 66 | "inputs": [ 67 | { 68 | "name": "_name", 69 | "type": "bytes32" 70 | }, 71 | { 72 | "name": "_newOwner", 73 | "type": "address" 74 | } 75 | ], 76 | "name": "transfer", 77 | "outputs": [], 78 | "type": "function" 79 | }, 80 | { 81 | "constant": false, 82 | "inputs": [ 83 | { 84 | "name": "_name", 85 | "type": "bytes32" 86 | }, 87 | { 88 | "name": "_a", 89 | "type": "address" 90 | } 91 | ], 92 | "name": "setAddr", 93 | "outputs": [], 94 | "type": "function" 95 | }, 96 | { 97 | "anonymous": false, 98 | "inputs": [ 99 | { 100 | "indexed": true, 101 | "name": "name", 102 | "type": "bytes32" 103 | } 104 | ], 105 | "name": "Changed", 106 | "type": "event" 107 | } 108 | ] 109 | -------------------------------------------------------------------------------- /document-sign-demo/test-truffle-vessel.js: -------------------------------------------------------------------------------- 1 | /* 2 | Below scripts are to be running in truffle console environment. 3 | */ 4 | 5 | var txnUrl = 'http://:8545'; 6 | web3.setProvider(new web3.providers.HttpProvider(txnUrl)); 7 | web3.personal.unlockAccount(web3.eth.accounts[0],''); 8 | var vesselContractBaseAddress = '0x8ea31de93f0714004cc1bb6bd46317f939aa0c44'; 9 | var fs = require('fs'); 10 | var abiArray = fs.readFileSync('./build/contracts/Vessel.json','utf-8'); 11 | var abi = JSON.parse(abiArray); 12 | var vessel = web3.eth.contract(abi.abi).at(vesselContractBaseAddress);// ({from:web3.eth.accounts[0], gas:3000000, data:abi.bytecode}); 13 | var opt = {from:web3.eth.accounts[0], gas:3000000}; 14 | 15 | var today = (new Date()); 16 | var expiry = (new Date( today.getFullYear() + 1, today.getMonth(), today.getDate() )); 17 | 18 | 19 | //============================= 20 | //var admin = web3.eth.accounts[0]; 21 | //var option = {from:admin}; 22 | //var gasValue = contract.UpdateInformation.estimateGas('Name of the Ship',10000,10000,'Owner Name 3','Owner Address', 'Designation' ,'POA' ,today.getTime(),expiry.getTime(),'Shipyard address', option); 23 | //option.gas = gasValue; 24 | //var hash = contract.UpdateInformation.sendTransaction('Name of the Ship',1,1,'Owner Name','Owner Address', 'Designation' ,'POA' ,today.getTime(),expiry.getTime(),'Shipyard address', option); 25 | //============================= 26 | 27 | //!!! Check Contract.Address to confirm it is mined by running contract.address to check if it is 'undefined' !!! 28 | var hash = vessel.NewBuilderCert.sendTransaction(2, opt); 29 | var result = web3.eth.getTransactionReceipt(hash); 30 | var resp = web3.eth.contract(abi.abi).at(result.to); 31 | var builderAddress = resp.GetBuildCert.call(2); 32 | 33 | abiArray = fs.readFileSync('./build/contracts/BuilderCert.json','utf-8'); 34 | abi = JSON.parse(abiArray); 35 | var builder = web3.eth.contract(abi.abi).at(builderAddress); 36 | 37 | hash = builder.UpdateInformation.sendTransaction('Name of the Ship',2,1,'Owner Name','Owner Address', 'Designation' ,'POA' ,today.getTime(),expiry.getTime(),'Shipyard address', opt); 38 | result = web3.eth.getTransactionReceipt(hash); 39 | resp = web3.eth.contract(abi.abi).at(result.to); 40 | 41 | resp.ShipownerName.call(); 42 | resp.IMO.call().toString(); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/sha224.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./sha256")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./sha256"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function () { 17 | // Shortcuts 18 | var C = CryptoJS; 19 | var C_lib = C.lib; 20 | var WordArray = C_lib.WordArray; 21 | var C_algo = C.algo; 22 | var SHA256 = C_algo.SHA256; 23 | 24 | /** 25 | * SHA-224 hash algorithm. 26 | */ 27 | var SHA224 = C_algo.SHA224 = SHA256.extend({ 28 | _doReset: function () { 29 | this._hash = new WordArray.init([ 30 | 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 31 | 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 32 | ]); 33 | }, 34 | 35 | _doFinalize: function () { 36 | var hash = SHA256._doFinalize.call(this); 37 | 38 | hash.sigBytes -= 4; 39 | 40 | return hash; 41 | } 42 | }); 43 | 44 | /** 45 | * Shortcut function to the hasher's object interface. 46 | * 47 | * @param {WordArray|string} message The message to hash. 48 | * 49 | * @return {WordArray} The hash. 50 | * 51 | * @static 52 | * 53 | * @example 54 | * 55 | * var hash = CryptoJS.SHA224('message'); 56 | * var hash = CryptoJS.SHA224(wordArray); 57 | */ 58 | C.SHA224 = SHA256._createHelper(SHA224); 59 | 60 | /** 61 | * Shortcut function to the HMAC's object interface. 62 | * 63 | * @param {WordArray|string} message The message to hash. 64 | * @param {WordArray|string} key The secret key. 65 | * 66 | * @return {WordArray} The HMAC. 67 | * 68 | * @static 69 | * 70 | * @example 71 | * 72 | * var hmac = CryptoJS.HmacSHA224(message, key); 73 | */ 74 | C.HmacSHA224 = SHA256._createHmacHelper(SHA224); 75 | }()); 76 | 77 | 78 | return CryptoJS.SHA224; 79 | 80 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/bignumber.js/perf/README.md: -------------------------------------------------------------------------------- 1 | This directory contains two command-line applications *bigtime.js* and *bigtime-OOM.js*, and for the browser *bignumber-vs-bigdecimal.html*, which enable some of the methods of bignumber.js to be tested against the JavaScript translations of the two versions of BigDecimal in the *lib* directory. 2 | 3 | * GWT: java.math.BigDecimal 4 | 5 | * ICU4J: com.ibm.icu.math.BigDecimal 6 | 7 | 8 | The BigDecimal in Node's npm registry is the GWT version. It has some bugs: see the Node script *perf/lib/bigdecimal_GWT/bugs.js* for examples of flaws in its *remainder*, *divide* and *compareTo* methods. 9 | 10 | An example of using *bigtime.js* to compare the time taken by the bignumber.js `plus` method and the GWT BigDecimal `add` method: 11 | 12 | $ node bigtime plus 10000 40 13 | 14 | This will time 10000 calls to each, using operands of up to 40 random digits and will check that the results match. 15 | 16 | For help: 17 | 18 | $ node bigtime -h 19 | 20 | *bigtime-OOM.js* works in the same way, but includes separate timings for object creation and method calls. 21 | 22 | In general, *bigtime.js* is recommended over *bigtime-OOM.js*, which may run out of memory. 23 | 24 | The usage of *bignumber-vs-bigdecimal.html* should be more or less self-explanatory. 25 | 26 | --- 27 | 28 | ###### Further notes: 29 | 30 | ###### bigtime.js 31 | 32 | * Creates random numbers and BigNumber and BigDecimal objects in batches. 33 | * Unlikely to run out of memory. 34 | * Doesn't show separate times for object creation and method calls. 35 | * Tests methods with one or two operands (i.e. includes abs and negate). 36 | * Doesn't indicate random number creation completion. 37 | * Doesn't calculate average number of digits of operands. 38 | * Creates random numbers in exponential notation. 39 | 40 | ###### bigtime-OOM.js 41 | 42 | * Creates random numbers and BigNumber and BigDecimal objects all in one go. 43 | * May run out of memory, e.g. if iterations > 500000 and random digits > 40. 44 | * Shows separate times for object creation and method calls. 45 | * Only tests methods with two operands (i.e. no abs or negate). 46 | * Indicates random number creation completion. 47 | * Calculates average number of digits of operands. 48 | * Creates random numbers in normal notation. 49 | -------------------------------------------------------------------------------- /document-sign-demo/smartcontracts/ClassCert.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.18; 2 | 3 | contract ClassCert { 4 | /* 5 | CLASS Cert 6 | - From Blockchain perspective 7 | • From 8 | ○ Class 9 | • To 10 | ○ Shipowner 11 | • Viewed by 12 | ○ Class 13 | ○ Shipowner 14 | ○ MPA 15 | - Content of Class cert 16 | • Name of Vessel 17 | • IMO Number or Official Number 18 | • Ship Type (category of ship) => A label, string 19 | • Date of issue 20 | • Date of expiry 21 | • GT 22 | • NT 23 | • Class Name (Name of Class) 24 | 25 | */ 26 | string public Version = "V1.0-2018-01-24"; 27 | string public NameOfShip = ""; 28 | uint32 public IMO = 0; 29 | string public ShipType = ""; 30 | string public ClassName =""; 31 | uint public DateOfIssue; 32 | uint public DateOfExpiry; 33 | string public GT; 34 | string public NT; 35 | 36 | function ClassCert () { 37 | 38 | } 39 | 40 | function stringsEqual(string memory _a, string memory _b) returns (bool) { 41 | bytes memory a = bytes(_a); 42 | bytes memory b = bytes(_b); 43 | if (a.length != b.length) { 44 | return false; 45 | } 46 | 47 | for (uint i = 0; i < a.length; i ++) { 48 | if (a[i] != b[i]) 49 | return false; 50 | } 51 | return true; 52 | } 53 | 54 | //event CertStateChanged(ContractStates newState); 55 | //enum ContractStates {Initiated, OwnerVerify, Completed, Signed } 56 | //ContractStates public State; 57 | 58 | function checkExpiry(uint start) public returns (bool) { 59 | return DateOfIssue + 1 years >= DateOfExpiry; 60 | } 61 | 62 | function UpdateInformation (string _NameOfShip, 63 | uint32 _IMO, 64 | string _ShipType, 65 | string _ClassName, 66 | uint _DateOfIssue, 67 | uint _DateOfExpiry, 68 | string _GT, 69 | string _NT) public payable 70 | { 71 | NameOfShip = _NameOfShip; 72 | IMO = _IMO; 73 | ShipType = _ShipType; 74 | ClassName = _ClassName; 75 | DateOfIssue = _DateOfIssue; 76 | DateOfExpiry = _DateOfExpiry; 77 | GT = _GT; 78 | NT = _NT; 79 | } 80 | } 81 | 82 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/mode-cfb.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * Cipher Feedback block mode. 18 | */ 19 | CryptoJS.mode.CFB = (function () { 20 | var CFB = CryptoJS.lib.BlockCipherMode.extend(); 21 | 22 | CFB.Encryptor = CFB.extend({ 23 | processBlock: function (words, offset) { 24 | // Shortcuts 25 | var cipher = this._cipher; 26 | var blockSize = cipher.blockSize; 27 | 28 | generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); 29 | 30 | // Remember this block to use with next block 31 | this._prevBlock = words.slice(offset, offset + blockSize); 32 | } 33 | }); 34 | 35 | CFB.Decryptor = CFB.extend({ 36 | processBlock: function (words, offset) { 37 | // Shortcuts 38 | var cipher = this._cipher; 39 | var blockSize = cipher.blockSize; 40 | 41 | // Remember this block to use with next block 42 | var thisBlock = words.slice(offset, offset + blockSize); 43 | 44 | generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); 45 | 46 | // This block becomes the previous block 47 | this._prevBlock = thisBlock; 48 | } 49 | }); 50 | 51 | function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) { 52 | // Shortcut 53 | var iv = this._iv; 54 | 55 | // Generate keystream 56 | if (iv) { 57 | var keystream = iv.slice(0); 58 | 59 | // Remove IV for subsequent blocks 60 | this._iv = undefined; 61 | } else { 62 | var keystream = this._prevBlock; 63 | } 64 | cipher.encryptBlock(keystream, 0); 65 | 66 | // Encrypt 67 | for (var i = 0; i < blockSize; i++) { 68 | words[offset + i] ^= keystream[i]; 69 | } 70 | } 71 | 72 | return CFB; 73 | }()); 74 | 75 | 76 | return CryptoJS.mode.CFB; 77 | 78 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/mode-cfb.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * Cipher Feedback block mode. 18 | */ 19 | CryptoJS.mode.CFB = (function () { 20 | var CFB = CryptoJS.lib.BlockCipherMode.extend(); 21 | 22 | CFB.Encryptor = CFB.extend({ 23 | processBlock: function (words, offset) { 24 | // Shortcuts 25 | var cipher = this._cipher; 26 | var blockSize = cipher.blockSize; 27 | 28 | generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); 29 | 30 | // Remember this block to use with next block 31 | this._prevBlock = words.slice(offset, offset + blockSize); 32 | } 33 | }); 34 | 35 | CFB.Decryptor = CFB.extend({ 36 | processBlock: function (words, offset) { 37 | // Shortcuts 38 | var cipher = this._cipher; 39 | var blockSize = cipher.blockSize; 40 | 41 | // Remember this block to use with next block 42 | var thisBlock = words.slice(offset, offset + blockSize); 43 | 44 | generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); 45 | 46 | // This block becomes the previous block 47 | this._prevBlock = thisBlock; 48 | } 49 | }); 50 | 51 | function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) { 52 | // Shortcut 53 | var iv = this._iv; 54 | 55 | // Generate keystream 56 | if (iv) { 57 | var keystream = iv.slice(0); 58 | 59 | // Remove IV for subsequent blocks 60 | this._iv = undefined; 61 | } else { 62 | var keystream = this._prevBlock; 63 | } 64 | cipher.encryptBlock(keystream, 0); 65 | 66 | // Encrypt 67 | for (var i = 0; i < blockSize; i++) { 68 | words[offset + i] ^= keystream[i]; 69 | } 70 | } 71 | 72 | return CFB; 73 | }()); 74 | 75 | 76 | return CryptoJS.mode.CFB; 77 | 78 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_args": [ 3 | [ 4 | "xhr2@0.1.4", 5 | "C:\\Temp\\0-Blockchain\\MPA" 6 | ] 7 | ], 8 | "_from": "xhr2@0.1.4", 9 | "_id": "xhr2@0.1.4", 10 | "_inBundle": false, 11 | "_integrity": "sha1-f4dliEdxbbUCYyOBL4GMras4el8=", 12 | "_location": "/xhr2", 13 | "_phantomChildren": {}, 14 | "_requested": { 15 | "type": "version", 16 | "registry": true, 17 | "raw": "xhr2@0.1.4", 18 | "name": "xhr2", 19 | "escapedName": "xhr2", 20 | "rawSpec": "0.1.4", 21 | "saveSpec": null, 22 | "fetchSpec": "0.1.4" 23 | }, 24 | "_requiredBy": [ 25 | "/web3" 26 | ], 27 | "_resolved": "https://registry.npmjs.org/xhr2/-/xhr2-0.1.4.tgz", 28 | "_spec": "0.1.4", 29 | "_where": "C:\\Temp\\0-Blockchain\\MPA", 30 | "author": { 31 | "name": "Victor Costan", 32 | "email": "victor@costan.us", 33 | "url": "http://www.costan.us" 34 | }, 35 | "browser": "lib/browser.js", 36 | "bugs": { 37 | "url": "https://github.com/pwnall/node-xhr2/issues" 38 | }, 39 | "contributors": [ 40 | { 41 | "name": "Daniel Friedman", 42 | "email": "dfriedman58@gmail.com" 43 | }, 44 | { 45 | "name": "Francois-Xavier Kowalski", 46 | "email": "francois-xavier.kowalski@hp.com" 47 | } 48 | ], 49 | "dependencies": {}, 50 | "description": "XMLHttpRequest emulation for node.js", 51 | "devDependencies": { 52 | "async": ">= 1.4.2", 53 | "chai": ">= 3.2.0", 54 | "codo": ">= 2.0.11", 55 | "coffee-script": ">= 1.9.3", 56 | "express": ">= 4.13.3", 57 | "glob": ">= 5.0.14", 58 | "mocha": ">= 2.2.5", 59 | "open": ">= 0.0.5", 60 | "remove": ">= 0.1.5", 61 | "sinon": ">= 1.15.4", 62 | "sinon-chai": ">= 2.8.0" 63 | }, 64 | "directories": { 65 | "doc": "doc", 66 | "lib": "lib", 67 | "src": "src", 68 | "test": "test" 69 | }, 70 | "engines": { 71 | "node": ">= 0.6" 72 | }, 73 | "homepage": "https://github.com/pwnall/node-xhr2", 74 | "keywords": [ 75 | "xhr", 76 | "xmlhttprequest", 77 | "ajax", 78 | "browser" 79 | ], 80 | "license": "MIT", 81 | "main": "lib/xhr2.js", 82 | "name": "xhr2", 83 | "repository": { 84 | "type": "git", 85 | "url": "git+https://github.com/pwnall/node-xhr2.git" 86 | }, 87 | "scripts": { 88 | "prepublish": "node_modules/coffee-script/bin/cake build", 89 | "test": "node_modules/coffee-script/bin/cake test" 90 | }, 91 | "version": "0.1.4" 92 | } 93 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/lib-typedarrays.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function () { 17 | // Check if typed arrays are supported 18 | if (typeof ArrayBuffer != 'function') { 19 | return; 20 | } 21 | 22 | // Shortcuts 23 | var C = CryptoJS; 24 | var C_lib = C.lib; 25 | var WordArray = C_lib.WordArray; 26 | 27 | // Reference original init 28 | var superInit = WordArray.init; 29 | 30 | // Augment WordArray.init to handle typed arrays 31 | var subInit = WordArray.init = function (typedArray) { 32 | // Convert buffers to uint8 33 | if (typedArray instanceof ArrayBuffer) { 34 | typedArray = new Uint8Array(typedArray); 35 | } 36 | 37 | // Convert other array views to uint8 38 | if ( 39 | typedArray instanceof Int8Array || 40 | (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) || 41 | typedArray instanceof Int16Array || 42 | typedArray instanceof Uint16Array || 43 | typedArray instanceof Int32Array || 44 | typedArray instanceof Uint32Array || 45 | typedArray instanceof Float32Array || 46 | typedArray instanceof Float64Array 47 | ) { 48 | typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength); 49 | } 50 | 51 | // Handle Uint8Array 52 | if (typedArray instanceof Uint8Array) { 53 | // Shortcut 54 | var typedArrayByteLength = typedArray.byteLength; 55 | 56 | // Extract bytes 57 | var words = []; 58 | for (var i = 0; i < typedArrayByteLength; i++) { 59 | words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8); 60 | } 61 | 62 | // Initialize this word array 63 | superInit.call(this, words, typedArrayByteLength); 64 | } else { 65 | // Else call normal init 66 | superInit.apply(this, arguments); 67 | } 68 | }; 69 | 70 | subInit.prototype = WordArray; 71 | }()); 72 | 73 | 74 | return CryptoJS.lib.WordArray; 75 | 76 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/lib-typedarrays.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function () { 17 | // Check if typed arrays are supported 18 | if (typeof ArrayBuffer != 'function') { 19 | return; 20 | } 21 | 22 | // Shortcuts 23 | var C = CryptoJS; 24 | var C_lib = C.lib; 25 | var WordArray = C_lib.WordArray; 26 | 27 | // Reference original init 28 | var superInit = WordArray.init; 29 | 30 | // Augment WordArray.init to handle typed arrays 31 | var subInit = WordArray.init = function (typedArray) { 32 | // Convert buffers to uint8 33 | if (typedArray instanceof ArrayBuffer) { 34 | typedArray = new Uint8Array(typedArray); 35 | } 36 | 37 | // Convert other array views to uint8 38 | if ( 39 | typedArray instanceof Int8Array || 40 | (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) || 41 | typedArray instanceof Int16Array || 42 | typedArray instanceof Uint16Array || 43 | typedArray instanceof Int32Array || 44 | typedArray instanceof Uint32Array || 45 | typedArray instanceof Float32Array || 46 | typedArray instanceof Float64Array 47 | ) { 48 | typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength); 49 | } 50 | 51 | // Handle Uint8Array 52 | if (typedArray instanceof Uint8Array) { 53 | // Shortcut 54 | var typedArrayByteLength = typedArray.byteLength; 55 | 56 | // Extract bytes 57 | var words = []; 58 | for (var i = 0; i < typedArrayByteLength; i++) { 59 | words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8); 60 | } 61 | 62 | // Initialize this word array 63 | superInit.call(this, words, typedArrayByteLength); 64 | } else { 65 | // Else call normal init 66 | superInit.apply(this, arguments); 67 | } 68 | }; 69 | 70 | subInit.prototype = WordArray; 71 | }()); 72 | 73 | 74 | return CryptoJS.lib.WordArray; 75 | 76 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/sha384.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./x64-core", "./sha512"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function () { 17 | // Shortcuts 18 | var C = CryptoJS; 19 | var C_x64 = C.x64; 20 | var X64Word = C_x64.Word; 21 | var X64WordArray = C_x64.WordArray; 22 | var C_algo = C.algo; 23 | var SHA512 = C_algo.SHA512; 24 | 25 | /** 26 | * SHA-384 hash algorithm. 27 | */ 28 | var SHA384 = C_algo.SHA384 = SHA512.extend({ 29 | _doReset: function () { 30 | this._hash = new X64WordArray.init([ 31 | new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507), 32 | new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939), 33 | new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511), 34 | new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4) 35 | ]); 36 | }, 37 | 38 | _doFinalize: function () { 39 | var hash = SHA512._doFinalize.call(this); 40 | 41 | hash.sigBytes -= 16; 42 | 43 | return hash; 44 | } 45 | }); 46 | 47 | /** 48 | * Shortcut function to the hasher's object interface. 49 | * 50 | * @param {WordArray|string} message The message to hash. 51 | * 52 | * @return {WordArray} The hash. 53 | * 54 | * @static 55 | * 56 | * @example 57 | * 58 | * var hash = CryptoJS.SHA384('message'); 59 | * var hash = CryptoJS.SHA384(wordArray); 60 | */ 61 | C.SHA384 = SHA512._createHelper(SHA384); 62 | 63 | /** 64 | * Shortcut function to the HMAC's object interface. 65 | * 66 | * @param {WordArray|string} message The message to hash. 67 | * @param {WordArray|string} key The secret key. 68 | * 69 | * @return {WordArray} The HMAC. 70 | * 71 | * @static 72 | * 73 | * @example 74 | * 75 | * var hmac = CryptoJS.HmacSHA384(message, key); 76 | */ 77 | C.HmacSHA384 = SHA512._createHmacHelper(SHA384); 78 | }()); 79 | 80 | 81 | return CryptoJS.SHA384; 82 | 83 | })); -------------------------------------------------------------------------------- /document-sign-demo/test-truffle-class.js: -------------------------------------------------------------------------------- 1 | /* 2 | Below scripts are to be running in truffle console environment. 3 | */ 4 | 5 | var txnUrl = ''; 6 | //web3.setProvider(new web3.providers.HttpProvider(txnUrl)); 7 | web3.personal.unlockAccount(web3.eth.accounts[0],'', 3000000); 8 | var contractAddress = '0x8ea31de93f0714004cc1bb6bd46317f939aa0c44';//vessel 9 | var fs = require('fs'); 10 | var abiArray = fs.readFileSync('./build/contracts/Vessel.json','utf-8'); 11 | var abi = JSON.parse(abiArray); 12 | var contract = web3.eth.contract(abi.abi).at(contractAddress);({from:web3.eth.accounts[0], gas:3000000, data:abi.bytecode}); 13 | 14 | var today = (new Date()); 15 | var opt = {from:web3.eth.accounts[0], gas:3000000}; 16 | var expiry = (new Date( today.getFullYear() + 1, today.getMonth(), today.getDate() )); 17 | 18 | 19 | /*=============================*/ 20 | //var admin = web3.eth.accounts[0]; 21 | //var option = {from:admin}; 22 | //var gasValue = contract.UpdateInformation.estimateGas('Name of the Ship',10000,10000,'Owner Name 3','Owner Address', 'Designation' ,'POA' ,today.getTime(),expiry.getTime(),'Shipyard address', option); 23 | //option.gas = gasValue; 24 | //var hash = contract.UpdateInformation.sendTransaction('Name of the Ship',1,1,'Owner Name','Owner Address', 'Designation' ,'POA' ,today.getTime(),expiry.getTime(),'Shipyard address', option); 25 | /*=============================*/ 26 | var IMO = 10; 27 | var vessel = web3.eth.contract(abi.abi).at(contractAddress); 28 | var hash = vessel.NewClassCert.sendTransaction(IMO, opt); 29 | var result = web3.eth.getTransactionReceipt(hash); 30 | var classAddress = vessel.GetClassCert.call(IMO); 31 | 32 | //!!! Check Contract.Address to confirm it is mined by running contract.address to check if it is 'undefined' !!! 33 | /* 34 | string _NameOfShip, 35 | uint32 _IMO, 36 | string _ShipType, 37 | string _ClassName, 38 | uint _DateOfIssue, 39 | uint _DateOfExpiry, 40 | string _GT, 41 | string _NT 42 | */ 43 | abiArray = fs.readFileSync('./build/contracts/ClassCert.json','utf-8'); 44 | abi = JSON.parse(abiArray); 45 | var cc = web3.eth.contract(abi.abi).at(classAddress); 46 | hash = cc.UpdateInformation.sendTransaction('Name of the Ship',IMO,'Type','Class',today.getTime(),expiry.getTime(),'GT','NT', opt); 47 | result = web3.eth.getTransactionReceipt(hash); 48 | var resp = web3.eth.contract(abi.abi).at(result.to); 49 | resp.GT.call(); 50 | resp.IMO.call().toString(); 51 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/sha384.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./x64-core", "./sha512"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function () { 17 | // Shortcuts 18 | var C = CryptoJS; 19 | var C_x64 = C.x64; 20 | var X64Word = C_x64.Word; 21 | var X64WordArray = C_x64.WordArray; 22 | var C_algo = C.algo; 23 | var SHA512 = C_algo.SHA512; 24 | 25 | /** 26 | * SHA-384 hash algorithm. 27 | */ 28 | var SHA384 = C_algo.SHA384 = SHA512.extend({ 29 | _doReset: function () { 30 | this._hash = new X64WordArray.init([ 31 | new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507), 32 | new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939), 33 | new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511), 34 | new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4) 35 | ]); 36 | }, 37 | 38 | _doFinalize: function () { 39 | var hash = SHA512._doFinalize.call(this); 40 | 41 | hash.sigBytes -= 16; 42 | 43 | return hash; 44 | } 45 | }); 46 | 47 | /** 48 | * Shortcut function to the hasher's object interface. 49 | * 50 | * @param {WordArray|string} message The message to hash. 51 | * 52 | * @return {WordArray} The hash. 53 | * 54 | * @static 55 | * 56 | * @example 57 | * 58 | * var hash = CryptoJS.SHA384('message'); 59 | * var hash = CryptoJS.SHA384(wordArray); 60 | */ 61 | C.SHA384 = SHA512._createHelper(SHA384); 62 | 63 | /** 64 | * Shortcut function to the HMAC's object interface. 65 | * 66 | * @param {WordArray|string} message The message to hash. 67 | * @param {WordArray|string} key The secret key. 68 | * 69 | * @return {WordArray} The HMAC. 70 | * 71 | * @static 72 | * 73 | * @example 74 | * 75 | * var hmac = CryptoJS.HmacSHA384(message, key); 76 | */ 77 | C.HmacSHA384 = SHA512._createHmacHelper(SHA384); 78 | }()); 79 | 80 | 81 | return CryptoJS.SHA384; 82 | 83 | })); -------------------------------------------------------------------------------- /document-sign-demo/test-truffle-tonnage.js: -------------------------------------------------------------------------------- 1 | /* 2 | Below scripts are to be running in truffle console environment. 3 | */ 4 | 5 | var txnUrl = 'http://:8545'; 6 | web3.setProvider(new web3.providers.HttpProvider(txnUrl)); 7 | web3.personal.unlockAccount(web3.eth.accounts[0],''); 8 | var contractAddress = '0x8ea31de93f0714004cc1bb6bd46317f939aa0c44';//vessel 9 | var fs = require('fs'); 10 | var abiArray = fs.readFileSync('./build/contracts/Vessel.json','utf-8'); 11 | var abi = JSON.parse(abiArray); 12 | var contract = web3.eth.contract(abi.abi).new({from:web3.eth.accounts[0], gas:3000000, data:abi.bytecode}); 13 | 14 | var today = (new Date()); 15 | var opt = {from:web3.eth.accounts[0], gas:3000000}; 16 | var expiry = (new Date( today.getFullYear() + 1, today.getMonth(), today.getDate() )); 17 | 18 | 19 | /*=============================*/ 20 | //var admin = web3.eth.accounts[0]; 21 | //var option = {from:admin}; 22 | //var gasValue = contract.UpdateInformation.estimateGas('Name of the Ship',10000,10000,'Owner Name 3','Owner Address', 'Designation' ,'POA' ,today.getTime(),expiry.getTime(),'Shipyard address', option); 23 | //option.gas = gasValue; 24 | //var hash = contract.UpdateInformation.sendTransaction('Name of the Ship',1,1,'Owner Name','Owner Address', 'Designation' ,'POA' ,today.getTime(),expiry.getTime(),'Shipyard address', option); 25 | /*=============================*/ 26 | var IMO = 10; 27 | var vessel = web3.eth.contract(abi.abi).at(contractAddress); 28 | var hash = vessel.NewTonnageCert.sendTransaction(IMO, opt); 29 | var result = web3.eth.getTransactionReceipt(hash); 30 | var tonnageAddress = vessel.GetTonnageCert.call(IMO); 31 | 32 | //!!! Check Contract.Address to confirm it is mined by running contract.address to check if it is 'undefined' !!! 33 | /* 34 | string _NameOfShip, 35 | uint32 _IMO, 36 | uint32 _Length, 37 | uint32 _Breadth, 38 | uint32 _Depth, 39 | string _ClassName, 40 | uint _DateOfIssue, 41 | string _GT, 42 | string _NT 43 | */ 44 | abiArray = fs.readFileSync('./build/contracts/TonnageCert.json','utf-8'); 45 | abi = JSON.parse(abiArray); 46 | var tonnage = web3.eth.contract(abi.abi).at(tonnageAddress); 47 | hash = tonnage.UpdateInformation.sendTransaction('Name of the Ship',IMO,100,100,100,'Class',today.getTime(),'GT','NT', opt); 48 | result = web3.eth.getTransactionReceipt(hash); 49 | var resp = web3.eth.contract(abi.abi).at(result.to); 50 | resp.GT.call(); 51 | resp.IMO.call().toString(); 52 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/node_modules/bignumber.js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "bignumber.js@git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934", 3 | "_id": "bignumber.js@2.0.7", 4 | "_inBundle": false, 5 | "_integrity": "sha1-SbF8Y3kv/LgPcf2jXQPeBRn0ieA=", 6 | "_location": "/web3/bignumber.js", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "git", 10 | "raw": "bignumber.js@git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934", 11 | "name": "bignumber.js", 12 | "escapedName": "bignumber.js", 13 | "rawSpec": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934", 14 | "saveSpec": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934", 15 | "fetchSpec": "https://github.com/frozeman/bignumber.js-nolookahead.git", 16 | "gitCommittish": "57692b3ecfc98bbdd6b3a516cb2353652ea49934" 17 | }, 18 | "_requiredBy": [ 19 | "/web3" 20 | ], 21 | "_resolved": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934", 22 | "_spec": "bignumber.js@git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934", 23 | "_where": "C:\\Temp\\0-Blockchain\\MPA", 24 | "author": { 25 | "name": "Michael Mclaughlin", 26 | "email": "M8ch88l@gmail.com" 27 | }, 28 | "bugs": { 29 | "url": "https://github.com/MikeMcl/bignumber.js/issues" 30 | }, 31 | "bundleDependencies": false, 32 | "dependencies": {}, 33 | "deprecated": false, 34 | "description": "A library for arbitrary-precision decimal and non-decimal arithmetic", 35 | "devDependencies": {}, 36 | "engines": { 37 | "node": "*" 38 | }, 39 | "homepage": "https://github.com/MikeMcl/bignumber.js#readme", 40 | "keywords": [ 41 | "arbitrary", 42 | "precision", 43 | "arithmetic", 44 | "big", 45 | "number", 46 | "decimal", 47 | "float", 48 | "biginteger", 49 | "bigdecimal", 50 | "bignumber", 51 | "bigint", 52 | "bignum" 53 | ], 54 | "license": "MIT", 55 | "main": "bignumber", 56 | "name": "bignumber.js", 57 | "optionalDependencies": {}, 58 | "repository": { 59 | "type": "git", 60 | "url": "git+https://github.com/MikeMcl/bignumber.js.git" 61 | }, 62 | "scripts": { 63 | "build": "uglifyjs bignumber.js --source-map bignumber.js.map -c -m -o bignumber.min.js --preamble \"/* bignumber.js v2.0.7 https://github.com/MikeMcl/bignumber.js/LICENCE */\"", 64 | "test": "node ./test/every-test.js" 65 | }, 66 | "version": "2.0.7" 67 | } 68 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/test/src/redirect_test.coffee: -------------------------------------------------------------------------------- 1 | describe 'XMLHttpRequest', -> 2 | describe 'when redirected', -> 3 | beforeEach -> 4 | @xhr = new XMLHttpRequest 5 | 6 | it 'issues a GET for the next location', (done) -> 7 | @xhr.open 'POST', 'http://localhost:8912/_/redirect/302/method' 8 | @xhr.onload = => 9 | expect(@xhr.responseText).to.match(/GET/i) 10 | done() 11 | @xhr.send 'This should be dropped during the redirect' 12 | 13 | it 'does not return the redirect headers', (done) -> 14 | @xhr.open 'GET', 'http://localhost:8912/_/redirect/302/method' 15 | @xhr.onload = => 16 | expect(@xhr.getResponseHeader('Content-Type')).to.equal( 17 | 'text/plain; charset=utf-8') 18 | expect(@xhr.getResponseHeader('X-Redirect-Header')).not.to.be.ok 19 | done() 20 | @xhr.send() 21 | 22 | it 'persists custom request headers across redirects', (done) -> 23 | @xhr.open 'GET', 'http://localhost:8912/_/redirect/302/headers' 24 | @xhr.setRequestHeader 'X-Redirect-Test', 'should be preserved' 25 | @xhr.onload = => 26 | expect(@xhr.responseText).to.match(/^\{.*\}$/) 27 | headers = JSON.parse @xhr.responseText 28 | expect(headers['connection']).to.equal 'keep-alive' 29 | expect(headers).to.have.property 'host' 30 | expect(headers['host']).to.equal 'localhost:8912' 31 | expect(headers).to.have.property 'x-redirect-test' 32 | expect(headers['x-redirect-test']).to.equal 'should be preserved' 33 | done() 34 | @xhr.send() 35 | 36 | it 'drops content-related headers across redirects', (done) -> 37 | @xhr.open 'POST', 'http://localhost:8912/_/redirect/302/headers' 38 | @xhr.setRequestHeader 'X-Redirect-Test', 'should be preserved' 39 | @xhr.onload = => 40 | expect(@xhr.responseText).to.match(/^\{.*\}$/) 41 | headers = JSON.parse @xhr.responseText 42 | expect(headers['connection']).to.equal 'keep-alive' 43 | expect(headers).to.have.property 'host' 44 | expect(headers['host']).to.equal 'localhost:8912' 45 | expect(headers).to.have.property 'x-redirect-test' 46 | expect(headers['x-redirect-test']).to.equal 'should be preserved' 47 | expect(headers).not.to.have.property 'content-type' 48 | expect(headers).not.to.have.property 'content-length' 49 | done() 50 | @xhr.send 'This should be dropped during the redirect' 51 | 52 | it 'provides the final responseURL', (done) -> 53 | @xhr.open 'GET', 'http://localhost:8912/_/redirect/302/method' 54 | @xhr.onload = => 55 | expect(@xhr.responseURL).to.equal("http://localhost:8912/_/method") 56 | done() 57 | @xhr.send() 58 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/example/contract.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 64 | 65 | 66 | contract 67 | 68 | 69 | 70 | create example contract 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/web3/jsonrpc.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of web3.js. 3 | 4 | web3.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | web3.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with web3.js. If not, see . 16 | */ 17 | /** @file jsonrpc.js 18 | * @authors: 19 | * Marek Kotewicz 20 | * Aaron Kumavis 21 | * @date 2015 22 | */ 23 | 24 | // Initialize Jsonrpc as a simple object with utility functions. 25 | var Jsonrpc = { 26 | messageId: 0 27 | }; 28 | 29 | /** 30 | * Should be called to valid json create payload object 31 | * 32 | * @method toPayload 33 | * @param {Function} method of jsonrpc call, required 34 | * @param {Array} params, an array of method params, optional 35 | * @returns {Object} valid jsonrpc payload object 36 | */ 37 | Jsonrpc.toPayload = function (method, params) { 38 | if (!method) 39 | console.error('jsonrpc method should be specified!'); 40 | 41 | // advance message ID 42 | Jsonrpc.messageId++; 43 | 44 | return { 45 | jsonrpc: '2.0', 46 | id: Jsonrpc.messageId, 47 | method: method, 48 | params: params || [] 49 | }; 50 | }; 51 | 52 | /** 53 | * Should be called to check if jsonrpc response is valid 54 | * 55 | * @method isValidResponse 56 | * @param {Object} 57 | * @returns {Boolean} true if response is valid, otherwise false 58 | */ 59 | Jsonrpc.isValidResponse = function (response) { 60 | return Array.isArray(response) ? response.every(validateSingleMessage) : validateSingleMessage(response); 61 | 62 | function validateSingleMessage(message){ 63 | return !!message && 64 | !message.error && 65 | message.jsonrpc === '2.0' && 66 | typeof message.id === 'number' && 67 | message.result !== undefined; // only undefined is not valid json object 68 | } 69 | }; 70 | 71 | /** 72 | * Should be called to create batch payload object 73 | * 74 | * @method toBatchPayload 75 | * @param {Array} messages, an array of objects with method (required) and params (optional) fields 76 | * @returns {Array} batch payload 77 | */ 78 | Jsonrpc.toBatchPayload = function (messages) { 79 | return messages.map(function (message) { 80 | return Jsonrpc.toPayload(message.method, message.params); 81 | }); 82 | }; 83 | 84 | module.exports = Jsonrpc; 85 | 86 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/xhr2/test/src/event_target_test.coffee: -------------------------------------------------------------------------------- 1 | describe 'XMLHttpRequestEventTarget', -> 2 | describe 'dispatchEvent', -> 3 | beforeEach -> 4 | @xhr = new XMLHttpRequest 5 | @loadEvent = new ProgressEvent 'load' 6 | 7 | it 'works with a DOM0 listener', -> 8 | count = 0 9 | @xhr.onload = (event) -> 10 | count += 1 11 | @xhr.dispatchEvent @loadEvent 12 | expect(count).to.equal 1 13 | 14 | it 'works with a DOM2 listener', -> 15 | count = 0 16 | @xhr.addEventListener 'load', (event) -> 17 | count += 1 18 | @xhr.dispatchEvent @loadEvent 19 | expect(count).to.equal 1 20 | 21 | it 'removes a DOM2 listener correctly', -> 22 | count = 0 23 | listener = (event) -> 24 | count += 1 25 | @xhr.addEventListener 'load', listener 26 | @xhr.dispatchEvent @loadEvent 27 | expect(count).to.equal 1 28 | 29 | count = 0 30 | @xhr.removeEventListener 'load', listener 31 | @xhr.dispatchEvent @loadEvent 32 | expect(count).to.equal 0 33 | 34 | it 'binds this correctly in a DOM0 listener', -> 35 | eventThis = null 36 | @xhr.onload = (event) -> 37 | eventThis = @ 38 | @xhr.dispatchEvent @loadEvent 39 | expect(eventThis).to.equal @xhr 40 | 41 | it 'binds this correctly in a DOM2 listener', -> 42 | eventThis = null 43 | @xhr.addEventListener 'load', (event) -> 44 | eventThis = @ 45 | @xhr.dispatchEvent @loadEvent 46 | expect(eventThis).to.equal @xhr 47 | 48 | it 'sets target correctly in a DOM0 listener', -> 49 | eventTarget = null 50 | @xhr.onload = (event) -> 51 | eventTarget = event.target 52 | @xhr.dispatchEvent @loadEvent 53 | expect(eventTarget).to.equal @xhr 54 | 55 | it 'sets target correctly in a DOM2 listener', -> 56 | eventTarget = null 57 | @xhr.addEventListener 'load', (event) -> 58 | eventTarget = event.target 59 | @xhr.dispatchEvent @loadEvent 60 | expect(eventTarget).to.equal @xhr 61 | 62 | it 'works with a DOM0 and two DOM2 listeners', -> 63 | count = [0, 0, 0] 64 | @xhr.addEventListener 'load', (event) -> 65 | count[1] += 1 66 | @xhr.onload = (event) -> 67 | count[0] += 1 68 | @xhr.addEventListener 'load', (event) -> 69 | count[2] += 1 70 | @xhr.dispatchEvent @loadEvent 71 | expect(count).to.deep.equal [1, 1, 1] 72 | 73 | it 'does not invoke a DOM0 listener for a different event', -> 74 | count = 0 75 | @xhr.onerror = (event) -> 76 | count += 1 77 | @xhr.dispatchEvent @loadEvent 78 | expect(count).to.equal 0 79 | 80 | it 'does not invoke a DOM2 listener for a different event', -> 81 | count = 0 82 | @xhr.addEventListener 'error', (event) -> 83 | count += 1 84 | @xhr.dispatchEvent @loadEvent 85 | expect(count).to.equal 0 86 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/example/contract_array.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 65 | 66 | 67 | contract 68 | 69 | 70 | 71 | create example contract 72 | 73 | 74 | var array = [0,6,5,2,1,5,6]; 75 | var x = array[ 76 | 77 | ]; 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/.idea/jsLinters/jshint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/crypto-js/mode-ctr-gladman.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** @preserve 17 | * Counter block mode compatible with Dr Brian Gladman fileenc.c 18 | * derived from CryptoJS.mode.CTR 19 | * Jan Hruby jhruby.web@gmail.com 20 | */ 21 | CryptoJS.mode.CTRGladman = (function () { 22 | var CTRGladman = CryptoJS.lib.BlockCipherMode.extend(); 23 | 24 | function incWord(word) 25 | { 26 | if (((word >> 24) & 0xff) === 0xff) { //overflow 27 | var b1 = (word >> 16)&0xff; 28 | var b2 = (word >> 8)&0xff; 29 | var b3 = word & 0xff; 30 | 31 | if (b1 === 0xff) // overflow b1 32 | { 33 | b1 = 0; 34 | if (b2 === 0xff) 35 | { 36 | b2 = 0; 37 | if (b3 === 0xff) 38 | { 39 | b3 = 0; 40 | } 41 | else 42 | { 43 | ++b3; 44 | } 45 | } 46 | else 47 | { 48 | ++b2; 49 | } 50 | } 51 | else 52 | { 53 | ++b1; 54 | } 55 | 56 | word = 0; 57 | word += (b1 << 16); 58 | word += (b2 << 8); 59 | word += b3; 60 | } 61 | else 62 | { 63 | word += (0x01 << 24); 64 | } 65 | return word; 66 | } 67 | 68 | function incCounter(counter) 69 | { 70 | if ((counter[0] = incWord(counter[0])) === 0) 71 | { 72 | // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8 73 | counter[1] = incWord(counter[1]); 74 | } 75 | return counter; 76 | } 77 | 78 | var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({ 79 | processBlock: function (words, offset) { 80 | // Shortcuts 81 | var cipher = this._cipher 82 | var blockSize = cipher.blockSize; 83 | var iv = this._iv; 84 | var counter = this._counter; 85 | 86 | // Generate keystream 87 | if (iv) { 88 | counter = this._counter = iv.slice(0); 89 | 90 | // Remove IV for subsequent blocks 91 | this._iv = undefined; 92 | } 93 | 94 | incCounter(counter); 95 | 96 | var keystream = counter.slice(0); 97 | cipher.encryptBlock(keystream, 0); 98 | 99 | // Encrypt 100 | for (var i = 0; i < blockSize; i++) { 101 | words[offset + i] ^= keystream[i]; 102 | } 103 | } 104 | }); 105 | 106 | CTRGladman.Decryptor = Encryptor; 107 | 108 | return CTRGladman; 109 | }()); 110 | 111 | 112 | 113 | 114 | return CryptoJS.mode.CTRGladman; 115 | 116 | })); -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/bower/crypto-js/mode-ctr-gladman.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** @preserve 17 | * Counter block mode compatible with Dr Brian Gladman fileenc.c 18 | * derived from CryptoJS.mode.CTR 19 | * Jan Hruby jhruby.web@gmail.com 20 | */ 21 | CryptoJS.mode.CTRGladman = (function () { 22 | var CTRGladman = CryptoJS.lib.BlockCipherMode.extend(); 23 | 24 | function incWord(word) 25 | { 26 | if (((word >> 24) & 0xff) === 0xff) { //overflow 27 | var b1 = (word >> 16)&0xff; 28 | var b2 = (word >> 8)&0xff; 29 | var b3 = word & 0xff; 30 | 31 | if (b1 === 0xff) // overflow b1 32 | { 33 | b1 = 0; 34 | if (b2 === 0xff) 35 | { 36 | b2 = 0; 37 | if (b3 === 0xff) 38 | { 39 | b3 = 0; 40 | } 41 | else 42 | { 43 | ++b3; 44 | } 45 | } 46 | else 47 | { 48 | ++b2; 49 | } 50 | } 51 | else 52 | { 53 | ++b1; 54 | } 55 | 56 | word = 0; 57 | word += (b1 << 16); 58 | word += (b2 << 8); 59 | word += b3; 60 | } 61 | else 62 | { 63 | word += (0x01 << 24); 64 | } 65 | return word; 66 | } 67 | 68 | function incCounter(counter) 69 | { 70 | if ((counter[0] = incWord(counter[0])) === 0) 71 | { 72 | // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8 73 | counter[1] = incWord(counter[1]); 74 | } 75 | return counter; 76 | } 77 | 78 | var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({ 79 | processBlock: function (words, offset) { 80 | // Shortcuts 81 | var cipher = this._cipher 82 | var blockSize = cipher.blockSize; 83 | var iv = this._iv; 84 | var counter = this._counter; 85 | 86 | // Generate keystream 87 | if (iv) { 88 | counter = this._counter = iv.slice(0); 89 | 90 | // Remove IV for subsequent blocks 91 | this._iv = undefined; 92 | } 93 | 94 | incCounter(counter); 95 | 96 | var keystream = counter.slice(0); 97 | cipher.encryptBlock(keystream, 0); 98 | 99 | // Encrypt 100 | for (var i = 0; i < blockSize; i++) { 101 | words[offset + i] ^= keystream[i]; 102 | } 103 | } 104 | }); 105 | 106 | CTRGladman.Decryptor = Encryptor; 107 | 108 | return CTRGladman; 109 | }()); 110 | 111 | 112 | 113 | 114 | return CryptoJS.mode.CTRGladman; 115 | 116 | })); -------------------------------------------------------------------------------- /oracle/nodeapp/oracleListener.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | /* 3 | OracleResolver4: 0x444078Aa15FE48B152245744cBD16023B2444C0e 4 | OracleContract4: 0x08c152C90F2775915B1EBC88C218A9B86307A775 5 | OracleApp4: 0x5074bf9892a1ce5be4126e53b8d7addc4b04f918 6 | */ 7 | 8 | var tx = 'http://13.92.177.20:8545'; 9 | var passpharse = 'Pwd=222222222'; 10 | var fs = require('fs'); 11 | var Web3 = require('web3'); 12 | var web3 = new Web3(); 13 | var oracleContractAddress = '0x08c152C90F2775915B1EBC88C218A9B86307A775';//deployed contract checksum address 14 | var clientContractAddress = '0xc3a486e2c58d8b3713af5848eb4303dc7e81946b'; 15 | 16 | web3.setProvider(new web3.providers.HttpProvider(tx)); 17 | 18 | //unlock accounts that we'll be using 19 | web3.personal.unlockAccount(web3.eth.accounts[0],passpharse,30000); //sender 20 | web3.personal.unlockAccount(web3.eth.accounts[1],passpharse,30000); //oracle 21 | 22 | function waitForTransactionReceipt(hash) { 23 | console.log('waiting for contract to be mined'); 24 | const receipt = web3.eth.getTransactionReceipt(hash); 25 | // If no receipt, try again in 1s 26 | if (receipt == null) { 27 | setTimeout(() => { 28 | waitForTransactionReceipt(hash); 29 | }, 1000); 30 | } else { 31 | // The transaction was mined, we can retrieve the contract address 32 | console.log('contract address: ' + receipt.contractAddress); 33 | //var result2 = cf3.UpdateContract.sendTransaction('newState',1,{from:web3.eth.accounts[0]}); 34 | console.log('receipt=' + JSON.stringify(receipt)); 35 | } 36 | } 37 | 38 | //configure Oracle callback address 39 | var text = fs.readFileSync('./contracts/OracleContract4.json','utf8'); 40 | var oracleInterface = JSON.parse(text); 41 | var oracle = web3.eth.contract(oracleInterface.abi).at(oracleContractAddress); 42 | //set callback address, this is the oracle account address, when oracle callback to our contract, the caller address must match address specified here 43 | var hash = oracle.setCallbackAddress.sendTransaction(web3.eth.accounts[1],{from:web3.eth.accounts[1],gas:3000000}); //'0x1f83fa84c03a2f4e50be16947a3991cab6018376' 44 | waitForTransactionReceipt(hash); 45 | 46 | //convert clientContractAddress to checksum address 47 | //clientContractAddress = web3.toChecksumAddress(clientContractAddress); 48 | 49 | var queryEvent = oracle.QueryEvent(); 50 | console.log('watching for query event'); 51 | 52 | queryEvent.watch(function(err,result){ 53 | if(!err){ 54 | console.log('QueryEvent fired:' + JSON.stringify(result)); 55 | //exact query parameters 56 | //var id = _.at(result, 'args.id'); 57 | //var query = _.at(result,'args.query'); 58 | }else{ 59 | console.log('error=' + JSON.stringify(err)); 60 | } 61 | }); 62 | 63 | text = fs.readFileSync('./contracts/myClientContract4.json','utf8'); 64 | var myContractInterface = JSON.parse(text); 65 | var myContract = web3.eth.contract(myContractInterface.abi).new({from:web3.eth.accounts[0],gas:3000000,data:myContractInterface.unlinked_binary}); 66 | -------------------------------------------------------------------------------- /document-sign-demo/node_modules/web3/lib/web3/transfer.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of web3.js. 3 | 4 | web3.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | web3.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with web3.js. If not, see . 16 | */ 17 | /** 18 | * @file transfer.js 19 | * @author Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | var Iban = require('./iban'); 24 | var exchangeAbi = require('../contracts/SmartExchange.json'); 25 | 26 | /** 27 | * Should be used to make Iban transfer 28 | * 29 | * @method transfer 30 | * @param {String} from 31 | * @param {String} to iban 32 | * @param {Value} value to be tranfered 33 | * @param {Function} callback, callback 34 | */ 35 | var transfer = function (eth, from, to, value, callback) { 36 | var iban = new Iban(to); 37 | if (!iban.isValid()) { 38 | throw new Error('invalid iban address'); 39 | } 40 | 41 | if (iban.isDirect()) { 42 | return transferToAddress(eth, from, iban.address(), value, callback); 43 | } 44 | 45 | if (!callback) { 46 | var address = eth.icapNamereg().addr(iban.institution()); 47 | return deposit(eth, from, address, value, iban.client()); 48 | } 49 | 50 | eth.icapNamereg().addr(iban.institution(), function (err, address) { 51 | return deposit(eth, from, address, value, iban.client(), callback); 52 | }); 53 | 54 | }; 55 | 56 | /** 57 | * Should be used to transfer funds to certain address 58 | * 59 | * @method transferToAddress 60 | * @param {String} from 61 | * @param {String} to 62 | * @param {Value} value to be tranfered 63 | * @param {Function} callback, callback 64 | */ 65 | var transferToAddress = function (eth, from, to, value, callback) { 66 | return eth.sendTransaction({ 67 | address: to, 68 | from: from, 69 | value: value 70 | }, callback); 71 | }; 72 | 73 | /** 74 | * Should be used to deposit funds to generic Exchange contract (must implement deposit(bytes32) method!) 75 | * 76 | * @method deposit 77 | * @param {String} from 78 | * @param {String} to 79 | * @param {Value} value to be transfered 80 | * @param {String} client unique identifier 81 | * @param {Function} callback, callback 82 | */ 83 | var deposit = function (eth, from, to, value, client, callback) { 84 | var abi = exchangeAbi; 85 | return eth.contract(abi).at(to).deposit(client, { 86 | from: from, 87 | value: value 88 | }, callback); 89 | }; 90 | 91 | module.exports = transfer; 92 | 93 | --------------------------------------------------------------------------------