├── .gitignore ├── LICENSE ├── README.md ├── apis ├── contact_myContracts.sh ├── contract_bind.sh ├── contract_create.sh ├── contract_getByRId.sh ├── contract_getTemplates.sh ├── file_getById.sh ├── file_getByMsghash.sh ├── file_sign.sh ├── finance_rec.sh ├── finance_transactions.sh ├── finance_wallet.sh ├── finance_withdraw2.sh ├── getToken.sh ├── order_create.sh ├── order_purchased.sh ├── order_transctionsByContractRId.sh └── signBlockData.sh ├── fixtures.js ├── package-lock.json ├── package.json └── samples ├── README.md ├── app.example.js ├── assets └── test.md ├── block.example.js ├── contract.example.js ├── demo.js ├── draft.example.js ├── file.example.js ├── finance.example.js ├── keystore.example.js ├── order.example.js ├── subscription.exmaple.js ├── user.example.js └── util.example.js /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | 63 | .DS_Store 64 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Press-One 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PRS SDK 简介 2 | 3 | PRS SDK 是 [prs-utility](https://github.com/Press-One/prs-utility-js) 和 [prs-lib](https://github.com/Press-One/prs-lib-js) 的示例代码合集。 4 | 5 | - `prs-utility` 是 PRS 提供的算法工具库,包含项目中需要使用的所有哈希、加密算法。 6 | - `prs-lib` 是对 PRS REST API 的封装,开发者可以直接调用与 PRS 服务通信。 7 | 8 | ## 使用方法及代码示例 9 | 10 | 在 samples 目录有所有的代码示例,使用方法: 11 | 12 | 1. 打开需要执行的某个示例文件,如 app.example.js,将其中的参数改成你自己的 DApp 参数。 13 | 2. 执行示例文件即可,如。 14 | 15 | ```bash 16 | npm i && cd samples 17 | node app.example.js 18 | ``` 19 | 20 | ## 如何开发 DApp 21 | 22 | ### 开发流程 23 | 24 | 1. 开发者前往 PRS 官网注册账号。(正式环境:https://press.one,测试环境:https://beta.press.one) 25 | 2. 登录成功后进入[开发者设置](https://beta.press.one/developer/settings)、[我的 DApp](https://beta.press.one/developer/apps),完善开发者信息以及创建 DApp。 26 | 3. 在项目中安装 [prs-utility](https://github.com/Press-One/prs-utility-js) 和 [prs-lib](https://github.com/Press-One/prs-lib-js) 。 27 | 4. DApp 在适当的时候,引导用户跳转到 PRS 提供的 Web 页面进行授权。 28 | 5. 授权成功后能够获取到 access token,拿到 token 之后即可进行签名发布文件、创建合约等操作。 29 | 30 | ### 创建 DApp 31 | 32 | 进入[我的 DApp](https://beta.press.one/developer/apps),填写必要信息(名称、描述、主页 URL、授权回调 URL)即可创建 DApp,创建成功后,能够获取到对应的 privateKey、publicKey、address,用于之后的用户授权。 33 | 34 | - `address`: DApp 在 PRS 系统中的唯一标识。 35 | - `privateKey`: 创建 DApp 时生成的私钥,用户通过 Web 授权时,开发者需要通过 privateKey 换取 token。 36 | 37 | ### 安装 38 | 39 | 通过 npm 安装: 40 | 41 | ```bash 42 | npm install prs-utility --save 43 | npm install prs-lib --save 44 | ``` 45 | 46 | ## 示例代码 47 | 48 | ```javascript 49 | // 1. 开发者前往 PRS 网站,创建 DApp,获取到对应的 address 和 privateKey。 50 | const appAddress = '7483f699284b55eb585b229c0ccee1f46fb893a8'; 51 | const appPrivateKey = '7552f60cdce1859e45e9ba3ec4b677c883a1016187c82415b2ffc45708e69670'; 52 | 53 | // 2. 开发者获取到授权页面,引导用户跳转到该页面进行授权。 54 | const client1 = new PRS({ env: 'env', debug: true }); 55 | const webAuthorizeUrl = client1.dapp.getAuthorizeUrl(appAddress); 56 | console.log('webAuthorizeUrl: ' + webAuthorizeUrl); 57 | 58 | // 3. 用户跳转至 webAuthorizeUrl 后,会显示[确认授权]按钮,如果用户点击[确定授权],页面会回调至 `REDIRECT_URL/?code=CODE`,此时就能通过 query string 拿到返回的 code。 59 | const code = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTMxNzc5NTcsImp0aSI6Ijg4MjQ3NDMzLWMxOTctNDFmMS04NTFlLTNmZDAwZWQzMWZkYSIsImRhdGEiOnsidXNlckFkZHJlc3MiOiJhZDMzNDc4NjdlNzBmNjRiYWY1ZDBjMzg4ZjIzYjQxOGNhMTA1Y2E1IiwiYXBwQWRkcmVzcyI6Ijc0ODNmNjk5Mjg0YjU1ZWI1ODViMjI5YzBjY2VlMWY0NmZiODkzYTgiLCJ0eXBlIjoiZW1haWwiLCJhdXRoQWRkcmVzcyI6IjU4NmE3OTdlZjhmZjQzNjJlMTY3MWZlYTM2ZGZhM2Y0MzFkMDcyMmMifSwicHJvdmlkZXIiOiJwcmVzc29uZSIsImV4cCI6MTU1MzQzNzE1N30.GyaPCApA8oR6PIV2ZoHG7gTwKf7x5JpqaqdzYHZtsMU'; 60 | 61 | // 4. 拿到code之后,开发者使用 appPrivateKey 调用接口换取 access token。 62 | const res1 = await client1.dapp.authByCode(code, appAddress, appPrivateKey); 63 | const token = res1.body.token; 64 | const authAddress = res1.body.appAuthentication.authAddress; 65 | console.log('token: ' + token); 66 | console.log('authAddress: ' + authAddress); 67 | 68 | // 5. 获取到 access token 之后即可签名文件。 69 | // 需要签名的文件,签名文件的内容不可重复。 70 | const markdownFile = `../${String(Date.now())}.md`; 71 | const markdownFileUrl = path.join(__dirname, markdownFile); 72 | fs.writeFileSync(markdownFileUrl, String(Date.now()), 'utf-8'); 73 | 74 | const client2 = new PRS({ env: 'env', debug: true, address: authAddress, token: token }); 75 | const stream = fs.createReadStream(markdownFileUrl); 76 | const data = { stream: stream, filename: 'text.md', title: 'xxx' }; 77 | const meta = { uuid: 'xxxx' }; 78 | const res2 = await client2.file.signByStream(data, meta); 79 | const fileHash = res2.body.cache.msghash; 80 | const fileRId = res2.body.cache.rId; 81 | console.log('fileHash: ' + fileHash); 82 | console.log('fileRId: ' + fileRId); 83 | 84 | fs.unlinkSync(markdownFileUrl) 85 | 86 | // 6. 签名成功之后,我们可以为文件绑定合约。 87 | // a. 创建合约。 创建合约需要遵循指定格式,目前收款人必须为创建者本人。具体可参考 DApp 开发者文档。 88 | const contractCode = `PRSC Ver 0.1 89 | Name 购买授权 90 | Desc 这是一个\\n测试合约 91 | Receiver ${authAddress} 92 | License usage1 CNB:0.001 Terms: 这是个人使用条款,禁止\\n商业应用。 93 | License usage2 CNB:0.002 Terms: 这是商业使用条款,允许\\n修改和复制。`; 94 | const contractRes = await client2.contract.create(contractCode); 95 | const contractRId = contractRes.body.contract.rId; 96 | console.log('contractRId: ' + contractRId); 97 | 98 | // b. 绑定合约。 99 | const bindRes = await client2.contract.bind(contractRId, fileRId, authAddress); 100 | console.log(bindRes.body); 101 | 102 | // 7. 合约绑定之后,其他用户就可以购买合约。 103 | const buyerAddress = '27d64b3524ef5679c4d7c3493088c70478a700db'; 104 | const buyerToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTMyMTcwMzgsImp0aSI6IjQzMzY2ZTFkLTQ4ODQtNDEyZS1hNDkwLWEwYzFiYWZmZmQxYyIsImRhdGEiOnsiYWRkcmVzcyI6IjI3ZDY0YjM1MjRlZjU2NzljNGQ3YzM0OTMwODhjNzA0NzhhNzAwZGIifSwiYXV0aFR5cGUiOiJwaG9uZSIsInByb3ZpZGVyIjoicHJlc3NvbmUiLCJleHAiOjE1NTM0NzYyMzh9.56zuwBenq4Dn2FJt3-8qeqtCdqCEFIs-wFZf5PVV5j8'; 105 | 106 | // 初始化 client 107 | const client3 = new PRS({ env: 'env', debug: true, address: buyerAddress, token: buyerToken}); 108 | 109 | const buyRes = client3.contract.createOrder(contractRId, fileRId, 'usage1'); 110 | console.log(buyRes.body); 111 | ``` 112 | 113 | ## 文档 114 | 115 | REST API 和 SDK 的具体使用方法,请参考[开发文档](https://developer.press.one) 116 | 117 | ## PRS 社区 118 | 119 | - [Twitter](https://twitter.com/PRESSoneHQ) 120 | - [微信公众号](https://mp.weixin.qq.com/s/C7yPdlEP5OVhbfWLtOBGTQ) 121 | - [开发者论坛](https://bbs.onedev.club) 122 | - [Medium](https://medium.com/@pressone/) 123 | -------------------------------------------------------------------------------- /apis/contact_myContracts.sh: -------------------------------------------------------------------------------- 1 | curl -X GET "https://beta.press.one/api/v2/contracts?offset=0&limit=1" \ 2 | -H "Content-Type: application/json" \ 3 | -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTIzNTM4MTMsImp0aSI6IjA4OTIxNjZiLTU3OTYtNDk2Yi04NTU0LTAwZTMxOWNhNGU1OCIsImRhdGEiOnsiYXV0aEFkZHJlc3MiOiIyNGJiODViMmEyZTcyYWY4NDllOGE4M2U5ZjJmY2UxZDdmOWY2Njg1In0sInByb3ZpZGVyIjoiZGFwcCJ9.qa76GKlcOHq-4salLQduPs3EHB3xWmlq7JJymYSAMmo" -------------------------------------------------------------------------------- /apis/contract_bind.sh: -------------------------------------------------------------------------------- 1 | curl -X POST https://beta.press.one/api/v2/contracts/6d21afd769ee7b6de4dea2835f5382580f38e9b068b317698f583478594e7d46/bind \ 2 | -H "Content-Type: application/json" \ 3 | -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTIzNTM4MTMsImp0aSI6IjA4OTIxNjZiLTU3OTYtNDk2Yi04NTU0LTAwZTMxOWNhNGU1OCIsImRhdGEiOnsiYXV0aEFkZHJlc3MiOiIyNGJiODViMmEyZTcyYWY4NDllOGE4M2U5ZjJmY2UxZDdmOWY2Njg1In0sInByb3ZpZGVyIjoiZGFwcCJ9.qa76GKlcOHq-4salLQduPs3EHB3xWmlq7JJymYSAMmo" \ 4 | -d '{ "payload": { "fileRId": "8b6885661754208a27d1aa3e23798e5e672c9fd856be2d8bf62d3b41c6f85424", "signature": "65fdb2a8d18957e66f5a8f27a78aff0152765872ec308b837c4650d4b8f1b88dca796c15885ac44b1231c51c244561043754a5a7a9e2c3bc5c224ad413a292ea0" } }' -------------------------------------------------------------------------------- /apis/contract_create.sh: -------------------------------------------------------------------------------- 1 | curl -X POST https://beta.press.one/api/v2/contracts \ 2 | -H "Content-Type: application/json" \ 3 | -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTIzNTM4MTMsImp0aSI6IjA4OTIxNjZiLTU3OTYtNDk2Yi04NTU0LTAwZTMxOWNhNGU1OCIsImRhdGEiOnsiYXV0aEFkZHJlc3MiOiIyNGJiODViMmEyZTcyYWY4NDllOGE4M2U5ZjJmY2UxZDdmOWY2Njg1In0sInByb3ZpZGVyIjoiZGFwcCJ9.qa76GKlcOHq-4salLQduPs3EHB3xWmlq7JJymYSAMmo" \ 4 | -d '{ "payload": { "code": "PRSC Ver 0.1\n Name 购买授权\n Desc 这是一个\\n测试合约\n Receiver 24bb85b2a2e72af849e8a83e9f2fce1d7f9f6685\n License usage1 CNB:0.001 Terms: 这是个人使用条款,禁止\\n商业应用。\n License usage2 CNB:0.002 Terms: 这是商业使用条款,允许\\n修改和复制。", "signature": "65fdb2a8d18957e66f5a8f27a78aff0152765872ec308b837c4650d4b8f1b88dca796c15885ac44b1231c51c244561043754a5a7a9e2c3bc5c224ad413a292ea0" } }' -------------------------------------------------------------------------------- /apis/contract_getByRId.sh: -------------------------------------------------------------------------------- 1 | curl -X GET https://beta.press.one/api/v2/contracts/6d21afd769ee7b6de4dea2835f5382580f38e9b068b317698f583478594e7d46 \ 2 | -H "Content-Type: application/json" \ 3 | -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTIzNTM4MTMsImp0aSI6IjA4OTIxNjZiLTU3OTYtNDk2Yi04NTU0LTAwZTMxOWNhNGU1OCIsImRhdGEiOnsiYXV0aEFkZHJlc3MiOiIyNGJiODViMmEyZTcyYWY4NDllOGE4M2U5ZjJmY2UxZDdmOWY2Njg1In0sInByb3ZpZGVyIjoiZGFwcCJ9.qa76GKlcOHq-4salLQduPs3EHB3xWmlq7JJymYSAMmo" -------------------------------------------------------------------------------- /apis/contract_getTemplates.sh: -------------------------------------------------------------------------------- 1 | curl -X GET 'https://beta.press.one/api/v2/contracts/templates?type=text' \ 2 | -H "Content-Type: application/json" \ 3 | -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTIzNTM4MTMsImp0aSI6IjA4OTIxNjZiLTU3OTYtNDk2Yi04NTU0LTAwZTMxOWNhNGU1OCIsImRhdGEiOnsiYXV0aEFkZHJlc3MiOiIyNGJiODViMmEyZTcyYWY4NDllOGE4M2U5ZjJmY2UxZDdmOWY2Njg1In0sInByb3ZpZGVyIjoiZGFwcCJ9.qa76GKlcOHq-4salLQduPs3EHB3xWmlq7JJymYSAMmo" -------------------------------------------------------------------------------- /apis/file_getById.sh: -------------------------------------------------------------------------------- 1 | curl -X GET https://beta.press.one/api/v2/files/8b6885661754208a27d1aa3e23798e5e672c9fd856be2d8bf62d3b41c6f85424 \ 2 | -H "Content-Type: application/json" \ 3 | -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTIzNTM4MTMsImp0aSI6IjA4OTIxNjZiLTU3OTYtNDk2Yi04NTU0LTAwZTMxOWNhNGU1OCIsImRhdGEiOnsiYXV0aEFkZHJlc3MiOiIyNGJiODViMmEyZTcyYWY4NDllOGE4M2U5ZjJmY2UxZDdmOWY2Njg1In0sInByb3ZpZGVyIjoiZGFwcCJ9.qa76GKlcOHq-4salLQduPs3EHB3xWmlq7JJymYSAMmo" 4 | -------------------------------------------------------------------------------- /apis/file_getByMsghash.sh: -------------------------------------------------------------------------------- 1 | curl -X GET https://beta.press.one/api/v2/files/hash/c6fc6b9c137342943300084208314dbb1a77128fde1906599a91ae735fffb436 \ 2 | -H "Content-Type: application/json" \ 3 | -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTIzNTM4MTMsImp0aSI6IjA4OTIxNjZiLTU3OTYtNDk2Yi04NTU0LTAwZTMxOWNhNGU1OCIsImRhdGEiOnsiYXV0aEFkZHJlc3MiOiIyNGJiODViMmEyZTcyYWY4NDllOGE4M2U5ZjJmY2UxZDdmOWY2Njg1In0sInByb3ZpZGVyIjoiZGFwcCJ9.qa76GKlcOHq-4salLQduPs3EHB3xWmlq7JJymYSAMmo" 4 | -------------------------------------------------------------------------------- /apis/file_sign.sh: -------------------------------------------------------------------------------- 1 | curl -X POST https://beta.press.one/api/v2/files \ 2 | -H "Content-Type: application/json" \ 3 | -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTIzNTM4MTMsImp0aSI6IjA4OTIxNjZiLTU3OTYtNDk2Yi04NTU0LTAwZTMxOWNhNGU1OCIsImRhdGEiOnsiYXV0aEFkZHJlc3MiOiIyNGJiODViMmEyZTcyYWY4NDllOGE4M2U5ZjJmY2UxZDdmOWY2Njg1In0sInByb3ZpZGVyIjoiZGFwcCJ9.qa76GKlcOHq-4salLQduPs3EHB3xWmlq7JJymYSAMmo" \ 4 | -H 'Content-Type: multipart/form-data; charset=utf-8; boundary=__X_PAW_BOUNDARY__' \ 5 | -F "address=${address}" \ 6 | -F "signature=${signature}" \ 7 | -F "title=${title}" \ 8 | -F "source=${source}" \ 9 | -F "originUrl=${originUrl}" \ 10 | -F "category=${category}" \ 11 | -F "file=${file}" -------------------------------------------------------------------------------- /apis/finance_rec.sh: -------------------------------------------------------------------------------- 1 | curl -X POST https://beta.press.one/api/v2/finance/withdraw \ 2 | -H "Content-Type: application/json" \ 3 | -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTIzNTM4MTMsImp0aSI6IjA4OTIxNjZiLTU3OTYtNDk2Yi04NTU0LTAwZTMxOWNhNGU1OCIsImRhdGEiOnsiYXV0aEFkZHJlc3MiOiIyNGJiODViMmEyZTcyYWY4NDllOGE4M2U5ZjJmY2UxZDdmOWY2Njg1In0sInByb3ZpZGVyIjoiZGFwcCJ9.qa76GKlcOHq-4salLQduPs3EHB3xWmlq7JJymYSAMmo" \ 4 | -d '{ "payload": { "amount": "1" } }' -------------------------------------------------------------------------------- /apis/finance_transactions.sh: -------------------------------------------------------------------------------- 1 | curl -X GET 'https://beta.press.one/api/v2/finance/transactions?offset=0&limit=1' \ 2 | -H "Content-Type: application/json" \ 3 | -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTIzNTM4MTMsImp0aSI6IjA4OTIxNjZiLTU3OTYtNDk2Yi04NTU0LTAwZTMxOWNhNGU1OCIsImRhdGEiOnsiYXV0aEFkZHJlc3MiOiIyNGJiODViMmEyZTcyYWY4NDllOGE4M2U5ZjJmY2UxZDdmOWY2Njg1In0sInByb3ZpZGVyIjoiZGFwcCJ9.qa76GKlcOHq-4salLQduPs3EHB3xWmlq7JJymYSAMmo" -------------------------------------------------------------------------------- /apis/finance_wallet.sh: -------------------------------------------------------------------------------- 1 | curl -X GET 'https://beta.press.one/api/v2/finance/wallet' \ 2 | -H "Content-Type: application/json" \ 3 | -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTIzNTM4MTMsImp0aSI6IjA4OTIxNjZiLTU3OTYtNDk2Yi04NTU0LTAwZTMxOWNhNGU1OCIsImRhdGEiOnsiYXV0aEFkZHJlc3MiOiIyNGJiODViMmEyZTcyYWY4NDllOGE4M2U5ZjJmY2UxZDdmOWY2Njg1In0sInByb3ZpZGVyIjoiZGFwcCJ9.qa76GKlcOHq-4salLQduPs3EHB3xWmlq7JJymYSAMmo" -------------------------------------------------------------------------------- /apis/finance_withdraw2.sh: -------------------------------------------------------------------------------- 1 | curl -X POST https://beta.press.one/api/v2/finance/withdraw \ 2 | -H "Content-Type: application/json" \ 3 | -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTIzNTM4MTMsImp0aSI6IjA4OTIxNjZiLTU3OTYtNDk2Yi04NTU0LTAwZTMxOWNhNGU1OCIsImRhdGEiOnsiYXV0aEFkZHJlc3MiOiIyNGJiODViMmEyZTcyYWY4NDllOGE4M2U5ZjJmY2UxZDdmOWY2Njg1In0sInByb3ZpZGVyIjoiZGFwcCJ9.qa76GKlcOHq-4salLQduPs3EHB3xWmlq7JJymYSAMmo" \ 4 | -d '{ "payload": { "amount": 1 } }' -------------------------------------------------------------------------------- /apis/getToken.sh: -------------------------------------------------------------------------------- 1 | curl -X POST https://beta.press.one/api/v2/apps/6b16c956d963e2c38e07d49af37b66a1de490a97/authenticate \ 2 | -H "Content-Type: application/json" \ 3 | -H "X-Po-Auth-Address: 6b16c956d963e2c38e07d49af37b66a1de490a97" \ 4 | -H "X-Po-Auth-Msghash: 7b61f7ee90d333017e4fc822adf196030ef8ae457c6f8d7b2f6b8776a6a50c6e" \ 5 | -H "X-Po-Auth-Sig: 7a405ca5a2f8d925e70be5346b7b3974a8f9b172c755555ba149cca8cc9c737e6c3e7d35e17893ea5893fb0515d0c5019f3ddd5ce716e813506a4f146eeefd9a1" \ 6 | -d '{ "payload": { "code": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTExOTU5MTUsImp0aSI6Ijg5M2NiMjAwLTNiNTQtNDYzNC1hODNlLWU3ZmJmNzQ3YjVjNiIsImRhdGEiOnsidXNlckFkZHJlc3MiOiJjYjdiNzUxMDNjNzMzY2M1NzQzYTM5MGZhZjdiZGVkYzYxNzg2ZTI5IiwiYXBwQWRkcmVzcyI6IjZiMTZjOTU2ZDk2M2UyYzM4ZTA3ZDQ5YWYzN2I2NmExZGU0OTBhOTciLCJ0eXBlIjoicGhvbmUifSwicHJvdmlkZXIiOiJwcmVzc29uZSIsImV4cCI6MTU1MTQ1NTExNX0.KQeimVWpEnTs-8FyvDYh-mppG1_kMKiPGZOf8mY3pfA" } }' 7 | -------------------------------------------------------------------------------- /apis/order_create.sh: -------------------------------------------------------------------------------- 1 | curl -X POST https://beta.press.one/api/v2/orders \ 2 | -H "Content-Type: application/json" \ 3 | -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTIzNTM4MTMsImp0aSI6IjA4OTIxNjZiLTU3OTYtNDk2Yi04NTU0LTAwZTMxOWNhNGU1OCIsImRhdGEiOnsiYXV0aEFkZHJlc3MiOiIyNGJiODViMmEyZTcyYWY4NDllOGE4M2U5ZjJmY2UxZDdmOWY2Njg1In0sInByb3ZpZGVyIjoiZGFwcCJ9.qa76GKlcOHq-4salLQduPs3EHB3xWmlq7JJymYSAMmo" \ 4 | -d '{ "payload": { "fileRId": "8b6885661754208a27d1aa3e23798e5e672c9fd856be2d8bf62d3b41c6f85424", "contractRId": "6d21afd769ee7b6de4dea2835f5382580f38e9b068b317698f583478594e7d46", "licenseType": "usage1" } }' -------------------------------------------------------------------------------- /apis/order_purchased.sh: -------------------------------------------------------------------------------- 1 | curl -X GET "https://beta.press.one/api/v2/orders?offset=0&limit=1" \ 2 | -H "Content-Type: application/json" \ 3 | -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTIzNTM4MTMsImp0aSI6IjA4OTIxNjZiLTU3OTYtNDk2Yi04NTU0LTAwZTMxOWNhNGU1OCIsImRhdGEiOnsiYXV0aEFkZHJlc3MiOiIyNGJiODViMmEyZTcyYWY4NDllOGE4M2U5ZjJmY2UxZDdmOWY2Njg1In0sInByb3ZpZGVyIjoiZGFwcCJ9.qa76GKlcOHq-4salLQduPs3EHB3xWmlq7JJymYSAMmo" -------------------------------------------------------------------------------- /apis/order_transctionsByContractRId.sh: -------------------------------------------------------------------------------- 1 | curl -X GET "https://beta.press.one/api/v2/contracts/6d21afd769ee7b6de4dea2835f5382580f38e9b068b317698f583478594e7d46/orders?offset=0&limit=1" \ 2 | -H "Content-Type: application/json" \ 3 | -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTIzNTM4MTMsImp0aSI6IjA4OTIxNjZiLTU3OTYtNDk2Yi04NTU0LTAwZTMxOWNhNGU1OCIsImRhdGEiOnsiYXV0aEFkZHJlc3MiOiIyNGJiODViMmEyZTcyYWY4NDllOGE4M2U5ZjJmY2UxZDdmOWY2Njg1In0sInByb3ZpZGVyIjoiZGFwcCJ9.qa76GKlcOHq-4salLQduPs3EHB3xWmlq7JJymYSAMmo" -------------------------------------------------------------------------------- /apis/signBlockData.sh: -------------------------------------------------------------------------------- 1 | curl -X POST https://beta.press.one/api/v2/sign \ 2 | -H "Content-Type: application/json" \ 3 | -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTIzNTM4MTMsImp0aSI6IjA4OTIxNjZiLTU3OTYtNDk2Yi04NTU0LTAwZTMxOWNhNGU1OCIsImRhdGEiOnsiYXV0aEFkZHJlc3MiOiIyNGJiODViMmEyZTcyYWY4NDllOGE4M2U5ZjJmY2UxZDdmOWY2Njg1In0sInByb3ZpZGVyIjoiZGFwcCJ9.qa76GKlcOHq-4salLQduPs3EHB3xWmlq7JJymYSAMmo" \ 4 | -d '{ "payload": { "data": { "file_hash": "8266d441d07f9a8ef9bd2513ed2b59c29520adc3b96de0948c9adb62a062f183" } } }' 5 | -------------------------------------------------------------------------------- /fixtures.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | developer: { 3 | email: 'test2@press.one', 4 | keystore: '{"address":"86248535534919506cc130b21a32383cf36c5b6a","crypto":{"cipher":"aes-128-ctr","ciphertext":"61d44823cfbadd15d67aba4167fe561b423168c04e99e609f9613212577d50fb","cipherparams":{"iv":"cb83cc76bf8f388f705173182613a442"},"mac":"856d5fa3af2060bfc71b395487cd428302539565602a61b4921ca3a16592fd5e","kdf":"pbkdf2","kdfparams":{"c":262144,"dklen":32,"prf":"hmac-sha256","salt":"6e023121e6934ae020438852d14214461171e2dce789e67d5472dd069fcd9eea"}},"id":"4cfd24f0-383a-469d-a65c-fe606af49f43","version":3}', 5 | password: 'nopassword', 6 | address: '86248535534919506cc130b21a32383cf36c5b6a' 7 | }, 8 | user: { 9 | email: 'foundation@163.com', 10 | keystore: '{"address":"758ea2601697fbd3ba6eb6774ed70b6c4cdb0ef9","crypto":{"cipher":"aes-128-ctr","ciphertext":"92af6f6710eba271eae5ac7fec72c70d9f49215e7880a0c45d4c53e56bd7ea59","cipherparams":{"iv":"13ddf95d970e924c97e4dcd29ba96520"},"mac":"b9d81d78f067334ee922fb2863e32c14cbc46e479eeb0acc11fb31e39256004e","kdf":"pbkdf2","kdfparams":{"c":262144,"dklen":32,"prf":"hmac-sha256","salt":"79f90bb603491573e40a79fe356b88d0c7869852e43c2bbaabed44578a82bbfa"}},"id":"93028e51-a2a4-4514-bc1a-94b089445f35","version":3}', 11 | password: '123123', 12 | address: '758ea2601697fbd3ba6eb6774ed70b6c4cdb0ef9' 13 | }, 14 | buyer: { 15 | email: 'test2@press.one', 16 | keystore: '{"address":"86248535534919506cc130b21a32383cf36c5b6a","crypto":{"cipher":"aes-128-ctr","ciphertext":"61d44823cfbadd15d67aba4167fe561b423168c04e99e609f9613212577d50fb","cipherparams":{"iv":"cb83cc76bf8f388f705173182613a442"},"mac":"856d5fa3af2060bfc71b395487cd428302539565602a61b4921ca3a16592fd5e","kdf":"pbkdf2","kdfparams":{"c":262144,"dklen":32,"prf":"hmac-sha256","salt":"6e023121e6934ae020438852d14214461171e2dce789e67d5472dd069fcd9eea"}},"id":"4cfd24f0-383a-469d-a65c-fe606af49f43","version":3}', 17 | password: 'nopassword', 18 | address: '86248535534919506cc130b21a32383cf36c5b6a' 19 | }, 20 | avat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w0vBTlb6nQz6eXJgnrA0Vsln+WuHecX2RmaeepqMWWbJ2X1yWbwfYvbZLp9JmfvpJzD9buHzlX372Y37t9W+SmDqBvfSp2KuzgUbQ0Hv90nnily9Q/fwOofE0+84Bd6p7pG7vMpOdVLyWySiKv3TuLIXCpLJEVLPt1uZhSQum7SZht1Nq6VWwCRMuTBC7lNcJ4IhEdhPLXl/n+a+/SrlYxK0L3JdfJrf7GKfOCTfe+jcu+n+LC/PP8O5BDftAleTj9MfHuLWzRJQOofOnGf7v6CQkxmsSOq2SrFscqtTIKSkFM2MEdF7oj0YomsLMqOXJLczWm7Trpg6n3/3z4dd++1u8++N3GN7dIWAq37UbRAVtudRi5TfnOHFimqSi+/0bX/LMiy9xYPTY/NnH+FaL+Hryg3JDB5QofgUWo6bFqk05qVsnph6H/gG29CSkvNmRTPtdDkxxYSw4TTCW5P8AnUhPxPqUg6kAAAAASUVORK5CYII=' 21 | } 22 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prs-sdk", 3 | "version": "0.0.5", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "abbrev": { 8 | "version": "1.1.1", 9 | "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", 10 | "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", 11 | "dev": true 12 | }, 13 | "ansi-regex": { 14 | "version": "2.1.1", 15 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", 16 | "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", 17 | "dev": true 18 | }, 19 | "aproba": { 20 | "version": "1.2.0", 21 | "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", 22 | "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", 23 | "dev": true 24 | }, 25 | "are-we-there-yet": { 26 | "version": "1.1.5", 27 | "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", 28 | "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", 29 | "dev": true, 30 | "requires": { 31 | "delegates": "^1.0.0", 32 | "readable-stream": "^2.0.6" 33 | } 34 | }, 35 | "asn1.js": { 36 | "version": "4.10.1", 37 | "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", 38 | "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", 39 | "requires": { 40 | "bn.js": "^4.0.0", 41 | "inherits": "^2.0.1", 42 | "minimalistic-assert": "^1.0.0" 43 | } 44 | }, 45 | "assertion-error": { 46 | "version": "1.1.0", 47 | "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", 48 | "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", 49 | "dev": true 50 | }, 51 | "asynckit": { 52 | "version": "0.4.0", 53 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 54 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" 55 | }, 56 | "balanced-match": { 57 | "version": "1.0.0", 58 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", 59 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", 60 | "dev": true 61 | }, 62 | "bindings": { 63 | "version": "1.3.1", 64 | "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.1.tgz", 65 | "integrity": "sha512-i47mqjF9UbjxJhxGf+pZ6kSxrnI3wBLlnGI2ArWJ4r0VrvDS7ZYXkprq/pLaBWYq4GM0r4zdHY+NNRqEMU7uew==" 66 | }, 67 | "bip66": { 68 | "version": "1.1.5", 69 | "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", 70 | "integrity": "sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI=", 71 | "requires": { 72 | "safe-buffer": "^5.0.1" 73 | } 74 | }, 75 | "bn.js": { 76 | "version": "4.11.8", 77 | "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", 78 | "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" 79 | }, 80 | "brace-expansion": { 81 | "version": "1.1.11", 82 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 83 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 84 | "dev": true, 85 | "requires": { 86 | "balanced-match": "^1.0.0", 87 | "concat-map": "0.0.1" 88 | } 89 | }, 90 | "brorand": { 91 | "version": "1.1.0", 92 | "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", 93 | "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" 94 | }, 95 | "browser-stdout": { 96 | "version": "1.3.1", 97 | "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", 98 | "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", 99 | "dev": true 100 | }, 101 | "browserify-aes": { 102 | "version": "1.2.0", 103 | "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", 104 | "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", 105 | "requires": { 106 | "buffer-xor": "^1.0.3", 107 | "cipher-base": "^1.0.0", 108 | "create-hash": "^1.1.0", 109 | "evp_bytestokey": "^1.0.3", 110 | "inherits": "^2.0.1", 111 | "safe-buffer": "^5.0.1" 112 | } 113 | }, 114 | "browserify-cipher": { 115 | "version": "1.0.1", 116 | "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", 117 | "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", 118 | "requires": { 119 | "browserify-aes": "^1.0.4", 120 | "browserify-des": "^1.0.0", 121 | "evp_bytestokey": "^1.0.0" 122 | } 123 | }, 124 | "browserify-des": { 125 | "version": "1.0.2", 126 | "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", 127 | "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", 128 | "requires": { 129 | "cipher-base": "^1.0.1", 130 | "des.js": "^1.0.0", 131 | "inherits": "^2.0.1", 132 | "safe-buffer": "^5.1.2" 133 | } 134 | }, 135 | "browserify-rsa": { 136 | "version": "4.0.1", 137 | "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", 138 | "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", 139 | "requires": { 140 | "bn.js": "^4.1.0", 141 | "randombytes": "^2.0.1" 142 | } 143 | }, 144 | "browserify-sign": { 145 | "version": "4.0.4", 146 | "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", 147 | "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", 148 | "requires": { 149 | "bn.js": "^4.1.1", 150 | "browserify-rsa": "^4.0.0", 151 | "create-hash": "^1.1.0", 152 | "create-hmac": "^1.1.2", 153 | "elliptic": "^6.0.0", 154 | "inherits": "^2.0.1", 155 | "parse-asn1": "^5.0.0" 156 | } 157 | }, 158 | "buffer-xor": { 159 | "version": "1.0.3", 160 | "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", 161 | "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" 162 | }, 163 | "camelcase": { 164 | "version": "4.1.0", 165 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", 166 | "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", 167 | "dev": true 168 | }, 169 | "canvas": { 170 | "version": "2.3.1", 171 | "resolved": "https://registry.npmjs.org/canvas/-/canvas-2.3.1.tgz", 172 | "integrity": "sha512-jSxwf4V9AGD6t6yBC600xFZKjrfKTR0T0RUNlX/AODs/ifrfJHIQjFEK8iF2euNy6z7K3GNv82DJgTjYZZktqA==", 173 | "dev": true, 174 | "requires": { 175 | "nan": "^2.12.1", 176 | "node-pre-gyp": "^0.11.0" 177 | } 178 | }, 179 | "chai": { 180 | "version": "4.2.0", 181 | "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", 182 | "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", 183 | "dev": true, 184 | "requires": { 185 | "assertion-error": "^1.1.0", 186 | "check-error": "^1.0.2", 187 | "deep-eql": "^3.0.1", 188 | "get-func-name": "^2.0.0", 189 | "pathval": "^1.1.0", 190 | "type-detect": "^4.0.5" 191 | } 192 | }, 193 | "charenc": { 194 | "version": "0.0.2", 195 | "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", 196 | "integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=" 197 | }, 198 | "check-error": { 199 | "version": "1.0.2", 200 | "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", 201 | "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", 202 | "dev": true 203 | }, 204 | "chownr": { 205 | "version": "1.1.1", 206 | "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", 207 | "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==", 208 | "dev": true 209 | }, 210 | "cipher-base": { 211 | "version": "1.0.4", 212 | "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", 213 | "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", 214 | "requires": { 215 | "inherits": "^2.0.1", 216 | "safe-buffer": "^5.0.1" 217 | } 218 | }, 219 | "cliui": { 220 | "version": "4.1.0", 221 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", 222 | "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", 223 | "dev": true, 224 | "requires": { 225 | "string-width": "^2.1.1", 226 | "strip-ansi": "^4.0.0", 227 | "wrap-ansi": "^2.0.0" 228 | }, 229 | "dependencies": { 230 | "ansi-regex": { 231 | "version": "3.0.0", 232 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", 233 | "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", 234 | "dev": true 235 | }, 236 | "is-fullwidth-code-point": { 237 | "version": "2.0.0", 238 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", 239 | "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", 240 | "dev": true 241 | }, 242 | "string-width": { 243 | "version": "2.1.1", 244 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", 245 | "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", 246 | "dev": true, 247 | "requires": { 248 | "is-fullwidth-code-point": "^2.0.0", 249 | "strip-ansi": "^4.0.0" 250 | } 251 | }, 252 | "strip-ansi": { 253 | "version": "4.0.0", 254 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", 255 | "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", 256 | "dev": true, 257 | "requires": { 258 | "ansi-regex": "^3.0.0" 259 | } 260 | } 261 | } 262 | }, 263 | "code-point-at": { 264 | "version": "1.1.0", 265 | "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", 266 | "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", 267 | "dev": true 268 | }, 269 | "combined-stream": { 270 | "version": "1.0.7", 271 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", 272 | "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", 273 | "requires": { 274 | "delayed-stream": "~1.0.0" 275 | } 276 | }, 277 | "commander": { 278 | "version": "2.15.1", 279 | "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", 280 | "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", 281 | "dev": true 282 | }, 283 | "component-emitter": { 284 | "version": "1.2.1", 285 | "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", 286 | "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" 287 | }, 288 | "concat-map": { 289 | "version": "0.0.1", 290 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 291 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", 292 | "dev": true 293 | }, 294 | "console-control-strings": { 295 | "version": "1.1.0", 296 | "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", 297 | "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", 298 | "dev": true 299 | }, 300 | "cookiejar": { 301 | "version": "2.1.2", 302 | "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", 303 | "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" 304 | }, 305 | "core-util-is": { 306 | "version": "1.0.2", 307 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 308 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", 309 | "dev": true 310 | }, 311 | "create-ecdh": { 312 | "version": "4.0.3", 313 | "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", 314 | "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", 315 | "requires": { 316 | "bn.js": "^4.1.0", 317 | "elliptic": "^6.0.0" 318 | } 319 | }, 320 | "create-hash": { 321 | "version": "1.2.0", 322 | "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", 323 | "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", 324 | "requires": { 325 | "cipher-base": "^1.0.1", 326 | "inherits": "^2.0.1", 327 | "md5.js": "^1.3.4", 328 | "ripemd160": "^2.0.1", 329 | "sha.js": "^2.4.0" 330 | } 331 | }, 332 | "create-hmac": { 333 | "version": "1.1.7", 334 | "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", 335 | "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", 336 | "requires": { 337 | "cipher-base": "^1.0.3", 338 | "create-hash": "^1.1.0", 339 | "inherits": "^2.0.1", 340 | "ripemd160": "^2.0.0", 341 | "safe-buffer": "^5.0.1", 342 | "sha.js": "^2.4.8" 343 | } 344 | }, 345 | "cross-spawn": { 346 | "version": "5.1.0", 347 | "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", 348 | "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", 349 | "dev": true, 350 | "requires": { 351 | "lru-cache": "^4.0.1", 352 | "shebang-command": "^1.2.0", 353 | "which": "^1.2.9" 354 | } 355 | }, 356 | "crypt": { 357 | "version": "0.0.2", 358 | "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", 359 | "integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=" 360 | }, 361 | "crypto-browserify": { 362 | "version": "3.12.0", 363 | "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", 364 | "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", 365 | "requires": { 366 | "browserify-cipher": "^1.0.0", 367 | "browserify-sign": "^4.0.0", 368 | "create-ecdh": "^4.0.0", 369 | "create-hash": "^1.1.0", 370 | "create-hmac": "^1.1.0", 371 | "diffie-hellman": "^5.0.0", 372 | "inherits": "^2.0.1", 373 | "pbkdf2": "^3.0.3", 374 | "public-encrypt": "^4.0.0", 375 | "randombytes": "^2.0.0", 376 | "randomfill": "^1.0.3" 377 | } 378 | }, 379 | "debug": { 380 | "version": "2.6.9", 381 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 382 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 383 | "dev": true, 384 | "requires": { 385 | "ms": "2.0.0" 386 | } 387 | }, 388 | "decamelize": { 389 | "version": "1.2.0", 390 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", 391 | "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", 392 | "dev": true 393 | }, 394 | "deep-eql": { 395 | "version": "3.0.1", 396 | "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", 397 | "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", 398 | "dev": true, 399 | "requires": { 400 | "type-detect": "^4.0.0" 401 | } 402 | }, 403 | "deep-extend": { 404 | "version": "0.6.0", 405 | "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", 406 | "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", 407 | "dev": true 408 | }, 409 | "delayed-stream": { 410 | "version": "1.0.0", 411 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 412 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" 413 | }, 414 | "delegates": { 415 | "version": "1.0.0", 416 | "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", 417 | "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", 418 | "dev": true 419 | }, 420 | "des.js": { 421 | "version": "1.0.0", 422 | "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", 423 | "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", 424 | "requires": { 425 | "inherits": "^2.0.1", 426 | "minimalistic-assert": "^1.0.0" 427 | } 428 | }, 429 | "detect-libc": { 430 | "version": "1.0.3", 431 | "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", 432 | "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", 433 | "dev": true 434 | }, 435 | "diff": { 436 | "version": "3.5.0", 437 | "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", 438 | "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", 439 | "dev": true 440 | }, 441 | "diffie-hellman": { 442 | "version": "5.0.3", 443 | "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", 444 | "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", 445 | "requires": { 446 | "bn.js": "^4.1.0", 447 | "miller-rabin": "^4.0.0", 448 | "randombytes": "^2.0.0" 449 | } 450 | }, 451 | "drbg.js": { 452 | "version": "1.0.1", 453 | "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", 454 | "integrity": "sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs=", 455 | "requires": { 456 | "browserify-aes": "^1.0.6", 457 | "create-hash": "^1.1.2", 458 | "create-hmac": "^1.1.4" 459 | } 460 | }, 461 | "elliptic": { 462 | "version": "6.4.1", 463 | "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", 464 | "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", 465 | "requires": { 466 | "bn.js": "^4.4.0", 467 | "brorand": "^1.0.1", 468 | "hash.js": "^1.0.0", 469 | "hmac-drbg": "^1.0.0", 470 | "inherits": "^2.0.1", 471 | "minimalistic-assert": "^1.0.0", 472 | "minimalistic-crypto-utils": "^1.0.0" 473 | } 474 | }, 475 | "escape-string-regexp": { 476 | "version": "1.0.5", 477 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", 478 | "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", 479 | "dev": true 480 | }, 481 | "ethereumjs-util": { 482 | "version": "5.2.0", 483 | "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz", 484 | "integrity": "sha512-CJAKdI0wgMbQFLlLRtZKGcy/L6pzVRgelIZqRqNbuVFM3K9VEnyfbcvz0ncWMRNCe4kaHWjwRYQcYMucmwsnWA==", 485 | "requires": { 486 | "bn.js": "^4.11.0", 487 | "create-hash": "^1.1.2", 488 | "ethjs-util": "^0.1.3", 489 | "keccak": "^1.0.2", 490 | "rlp": "^2.0.0", 491 | "safe-buffer": "^5.1.1", 492 | "secp256k1": "^3.0.1" 493 | } 494 | }, 495 | "ethjs-util": { 496 | "version": "0.1.6", 497 | "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", 498 | "integrity": "sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w==", 499 | "requires": { 500 | "is-hex-prefixed": "1.0.0", 501 | "strip-hex-prefix": "1.0.0" 502 | } 503 | }, 504 | "evp_bytestokey": { 505 | "version": "1.0.3", 506 | "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", 507 | "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", 508 | "requires": { 509 | "md5.js": "^1.3.4", 510 | "safe-buffer": "^5.1.1" 511 | } 512 | }, 513 | "execa": { 514 | "version": "0.7.0", 515 | "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", 516 | "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", 517 | "dev": true, 518 | "requires": { 519 | "cross-spawn": "^5.0.1", 520 | "get-stream": "^3.0.0", 521 | "is-stream": "^1.1.0", 522 | "npm-run-path": "^2.0.0", 523 | "p-finally": "^1.0.0", 524 | "signal-exit": "^3.0.0", 525 | "strip-eof": "^1.0.0" 526 | } 527 | }, 528 | "extend": { 529 | "version": "3.0.2", 530 | "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", 531 | "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", 532 | "dev": true 533 | }, 534 | "find-up": { 535 | "version": "2.1.0", 536 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", 537 | "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", 538 | "dev": true, 539 | "requires": { 540 | "locate-path": "^2.0.0" 541 | } 542 | }, 543 | "form-data": { 544 | "version": "2.3.3", 545 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", 546 | "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", 547 | "requires": { 548 | "asynckit": "^0.4.0", 549 | "combined-stream": "^1.0.6", 550 | "mime-types": "^2.1.12" 551 | } 552 | }, 553 | "formidable": { 554 | "version": "1.2.1", 555 | "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.1.tgz", 556 | "integrity": "sha512-Fs9VRguL0gqGHkXS5GQiMCr1VhZBxz0JnJs4JmMp/2jL18Fmbzvv7vOFRU+U8TBkHEE/CX1qDXzJplVULgsLeg==" 557 | }, 558 | "fs-minipass": { 559 | "version": "1.2.5", 560 | "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", 561 | "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", 562 | "dev": true, 563 | "requires": { 564 | "minipass": "^2.2.1" 565 | } 566 | }, 567 | "fs.realpath": { 568 | "version": "1.0.0", 569 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 570 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", 571 | "dev": true 572 | }, 573 | "gauge": { 574 | "version": "2.7.4", 575 | "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", 576 | "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", 577 | "dev": true, 578 | "requires": { 579 | "aproba": "^1.0.3", 580 | "console-control-strings": "^1.0.0", 581 | "has-unicode": "^2.0.0", 582 | "object-assign": "^4.1.0", 583 | "signal-exit": "^3.0.0", 584 | "string-width": "^1.0.1", 585 | "strip-ansi": "^3.0.1", 586 | "wide-align": "^1.1.0" 587 | } 588 | }, 589 | "get-caller-file": { 590 | "version": "1.0.3", 591 | "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", 592 | "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", 593 | "dev": true 594 | }, 595 | "get-func-name": { 596 | "version": "2.0.0", 597 | "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", 598 | "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", 599 | "dev": true 600 | }, 601 | "get-stream": { 602 | "version": "3.0.0", 603 | "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", 604 | "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", 605 | "dev": true 606 | }, 607 | "glob": { 608 | "version": "7.1.3", 609 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", 610 | "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", 611 | "dev": true, 612 | "requires": { 613 | "fs.realpath": "^1.0.0", 614 | "inflight": "^1.0.4", 615 | "inherits": "2", 616 | "minimatch": "^3.0.4", 617 | "once": "^1.3.0", 618 | "path-is-absolute": "^1.0.0" 619 | } 620 | }, 621 | "growl": { 622 | "version": "1.10.5", 623 | "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", 624 | "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", 625 | "dev": true 626 | }, 627 | "has-flag": { 628 | "version": "3.0.0", 629 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", 630 | "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", 631 | "dev": true 632 | }, 633 | "has-unicode": { 634 | "version": "2.0.1", 635 | "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", 636 | "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", 637 | "dev": true 638 | }, 639 | "hash-base": { 640 | "version": "3.0.4", 641 | "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", 642 | "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", 643 | "requires": { 644 | "inherits": "^2.0.1", 645 | "safe-buffer": "^5.0.1" 646 | } 647 | }, 648 | "hash.js": { 649 | "version": "1.1.7", 650 | "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", 651 | "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", 652 | "requires": { 653 | "inherits": "^2.0.3", 654 | "minimalistic-assert": "^1.0.1" 655 | } 656 | }, 657 | "he": { 658 | "version": "1.1.1", 659 | "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", 660 | "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", 661 | "dev": true 662 | }, 663 | "hmac-drbg": { 664 | "version": "1.0.1", 665 | "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", 666 | "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", 667 | "requires": { 668 | "hash.js": "^1.0.3", 669 | "minimalistic-assert": "^1.0.0", 670 | "minimalistic-crypto-utils": "^1.0.1" 671 | } 672 | }, 673 | "iconv-lite": { 674 | "version": "0.4.24", 675 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 676 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 677 | "dev": true, 678 | "requires": { 679 | "safer-buffer": ">= 2.1.2 < 3" 680 | } 681 | }, 682 | "ignore-walk": { 683 | "version": "3.0.1", 684 | "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", 685 | "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", 686 | "dev": true, 687 | "requires": { 688 | "minimatch": "^3.0.4" 689 | } 690 | }, 691 | "inflight": { 692 | "version": "1.0.6", 693 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 694 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 695 | "dev": true, 696 | "requires": { 697 | "once": "^1.3.0", 698 | "wrappy": "1" 699 | } 700 | }, 701 | "inherits": { 702 | "version": "2.0.3", 703 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 704 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 705 | }, 706 | "ini": { 707 | "version": "1.3.5", 708 | "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", 709 | "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", 710 | "dev": true 711 | }, 712 | "invert-kv": { 713 | "version": "1.0.0", 714 | "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", 715 | "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", 716 | "dev": true 717 | }, 718 | "is-buffer": { 719 | "version": "1.1.6", 720 | "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", 721 | "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" 722 | }, 723 | "is-fullwidth-code-point": { 724 | "version": "1.0.0", 725 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", 726 | "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", 727 | "dev": true, 728 | "requires": { 729 | "number-is-nan": "^1.0.0" 730 | } 731 | }, 732 | "is-hex-prefixed": { 733 | "version": "1.0.0", 734 | "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", 735 | "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" 736 | }, 737 | "is-stream": { 738 | "version": "1.1.0", 739 | "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", 740 | "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", 741 | "dev": true 742 | }, 743 | "isarray": { 744 | "version": "1.0.0", 745 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 746 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", 747 | "dev": true 748 | }, 749 | "isexe": { 750 | "version": "2.0.0", 751 | "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", 752 | "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", 753 | "dev": true 754 | }, 755 | "js-sha3": { 756 | "version": "0.7.0", 757 | "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.7.0.tgz", 758 | "integrity": "sha512-Wpks3yBDm0UcL5qlVhwW9Jr9n9i4FfeWBFOOXP5puDS/SiudJGhw7DPyBqn3487qD4F0lsC0q3zxink37f7zeA==" 759 | }, 760 | "keccak": { 761 | "version": "1.4.0", 762 | "resolved": "https://registry.npmjs.org/keccak/-/keccak-1.4.0.tgz", 763 | "integrity": "sha512-eZVaCpblK5formjPjeTBik7TAg+pqnDrMHIffSvi9Lh7PQgM1+hSzakUeZFCk9DVVG0dacZJuaz2ntwlzZUIBw==", 764 | "requires": { 765 | "bindings": "^1.2.1", 766 | "inherits": "^2.0.3", 767 | "nan": "^2.2.1", 768 | "safe-buffer": "^5.1.0" 769 | } 770 | }, 771 | "keythereum": { 772 | "version": "1.0.4", 773 | "resolved": "https://registry.npmjs.org/keythereum/-/keythereum-1.0.4.tgz", 774 | "integrity": "sha512-c3gWM0nQ6x5TKAzTOA1yIqn73S8sP9+lR7mc7QS6t509g7C0/CukykxGA6+B+aXI6BIrlSwVh5muPv/I1lD9LA==", 775 | "requires": { 776 | "crypto-browserify": "3.12.0", 777 | "keccak": "1.4.0", 778 | "scrypt": "6.0.3", 779 | "secp256k1": "3.5.0", 780 | "sjcl": "1.0.6", 781 | "uuid": "3.0.0" 782 | }, 783 | "dependencies": { 784 | "secp256k1": { 785 | "version": "3.5.0", 786 | "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.5.0.tgz", 787 | "integrity": "sha512-e5QIJl8W7Y4tT6LHffVcZAxJjvpgE5Owawv6/XCYPQljE9aP2NFFddQ8OYMKhdLshNu88FfL3qCN3/xYkXGRsA==", 788 | "requires": { 789 | "bindings": "^1.2.1", 790 | "bip66": "^1.1.3", 791 | "bn.js": "^4.11.3", 792 | "create-hash": "^1.1.2", 793 | "drbg.js": "^1.0.1", 794 | "elliptic": "^6.2.3", 795 | "nan": "^2.2.1", 796 | "safe-buffer": "^5.1.0" 797 | } 798 | } 799 | } 800 | }, 801 | "lcid": { 802 | "version": "1.0.0", 803 | "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", 804 | "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", 805 | "dev": true, 806 | "requires": { 807 | "invert-kv": "^1.0.0" 808 | } 809 | }, 810 | "locate-path": { 811 | "version": "2.0.0", 812 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", 813 | "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", 814 | "dev": true, 815 | "requires": { 816 | "p-locate": "^2.0.0", 817 | "path-exists": "^3.0.0" 818 | } 819 | }, 820 | "lru-cache": { 821 | "version": "4.1.5", 822 | "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", 823 | "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", 824 | "dev": true, 825 | "requires": { 826 | "pseudomap": "^1.0.2", 827 | "yallist": "^2.1.2" 828 | }, 829 | "dependencies": { 830 | "yallist": { 831 | "version": "2.1.2", 832 | "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", 833 | "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", 834 | "dev": true 835 | } 836 | } 837 | }, 838 | "md5": { 839 | "version": "2.2.1", 840 | "resolved": "https://registry.npmjs.org/md5/-/md5-2.2.1.tgz", 841 | "integrity": "sha1-U6s41f48iJG6RlMp6iP6wFQBJvk=", 842 | "requires": { 843 | "charenc": "~0.0.1", 844 | "crypt": "~0.0.1", 845 | "is-buffer": "~1.1.1" 846 | } 847 | }, 848 | "md5.js": { 849 | "version": "1.3.5", 850 | "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", 851 | "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", 852 | "requires": { 853 | "hash-base": "^3.0.0", 854 | "inherits": "^2.0.1", 855 | "safe-buffer": "^5.1.2" 856 | } 857 | }, 858 | "mem": { 859 | "version": "1.1.0", 860 | "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", 861 | "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", 862 | "dev": true, 863 | "requires": { 864 | "mimic-fn": "^1.0.0" 865 | } 866 | }, 867 | "methods": { 868 | "version": "1.1.2", 869 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 870 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" 871 | }, 872 | "miller-rabin": { 873 | "version": "4.0.1", 874 | "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", 875 | "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", 876 | "requires": { 877 | "bn.js": "^4.0.0", 878 | "brorand": "^1.0.1" 879 | } 880 | }, 881 | "mime": { 882 | "version": "2.4.0", 883 | "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.0.tgz", 884 | "integrity": "sha512-ikBcWwyqXQSHKtciCcctu9YfPbFYZ4+gbHEmE0Q8jzcTYQg5dHCr3g2wwAZjPoJfQVXZq6KXAjpXOTf5/cjT7w==" 885 | }, 886 | "mime-db": { 887 | "version": "1.37.0", 888 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", 889 | "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==" 890 | }, 891 | "mime-types": { 892 | "version": "2.1.21", 893 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", 894 | "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", 895 | "requires": { 896 | "mime-db": "~1.37.0" 897 | } 898 | }, 899 | "mimic-fn": { 900 | "version": "1.2.0", 901 | "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", 902 | "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", 903 | "dev": true 904 | }, 905 | "minimalistic-assert": { 906 | "version": "1.0.1", 907 | "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", 908 | "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" 909 | }, 910 | "minimalistic-crypto-utils": { 911 | "version": "1.0.1", 912 | "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", 913 | "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" 914 | }, 915 | "minimatch": { 916 | "version": "3.0.4", 917 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 918 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 919 | "dev": true, 920 | "requires": { 921 | "brace-expansion": "^1.1.7" 922 | } 923 | }, 924 | "minimist": { 925 | "version": "0.0.8", 926 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", 927 | "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", 928 | "dev": true 929 | }, 930 | "minipass": { 931 | "version": "2.3.5", 932 | "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", 933 | "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", 934 | "dev": true, 935 | "requires": { 936 | "safe-buffer": "^5.1.2", 937 | "yallist": "^3.0.0" 938 | } 939 | }, 940 | "minizlib": { 941 | "version": "1.2.1", 942 | "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", 943 | "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", 944 | "dev": true, 945 | "requires": { 946 | "minipass": "^2.2.1" 947 | } 948 | }, 949 | "mkdirp": { 950 | "version": "0.5.1", 951 | "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", 952 | "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", 953 | "dev": true, 954 | "requires": { 955 | "minimist": "0.0.8" 956 | } 957 | }, 958 | "mocha": { 959 | "version": "5.2.0", 960 | "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", 961 | "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", 962 | "dev": true, 963 | "requires": { 964 | "browser-stdout": "1.3.1", 965 | "commander": "2.15.1", 966 | "debug": "3.1.0", 967 | "diff": "3.5.0", 968 | "escape-string-regexp": "1.0.5", 969 | "glob": "7.1.2", 970 | "growl": "1.10.5", 971 | "he": "1.1.1", 972 | "minimatch": "3.0.4", 973 | "mkdirp": "0.5.1", 974 | "supports-color": "5.4.0" 975 | }, 976 | "dependencies": { 977 | "debug": { 978 | "version": "3.1.0", 979 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", 980 | "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", 981 | "dev": true, 982 | "requires": { 983 | "ms": "2.0.0" 984 | } 985 | }, 986 | "glob": { 987 | "version": "7.1.2", 988 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", 989 | "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", 990 | "dev": true, 991 | "requires": { 992 | "fs.realpath": "^1.0.0", 993 | "inflight": "^1.0.4", 994 | "inherits": "2", 995 | "minimatch": "^3.0.4", 996 | "once": "^1.3.0", 997 | "path-is-absolute": "^1.0.0" 998 | } 999 | } 1000 | } 1001 | }, 1002 | "ms": { 1003 | "version": "2.0.0", 1004 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 1005 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", 1006 | "dev": true 1007 | }, 1008 | "nan": { 1009 | "version": "2.12.1", 1010 | "resolved": "https://registry.npmjs.org/nan/-/nan-2.12.1.tgz", 1011 | "integrity": "sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==" 1012 | }, 1013 | "needle": { 1014 | "version": "2.2.4", 1015 | "resolved": "https://registry.npmjs.org/needle/-/needle-2.2.4.tgz", 1016 | "integrity": "sha512-HyoqEb4wr/rsoaIDfTH2aVL9nWtQqba2/HvMv+++m8u0dz808MaagKILxtfeSN7QU7nvbQ79zk3vYOJp9zsNEA==", 1017 | "dev": true, 1018 | "requires": { 1019 | "debug": "^2.1.2", 1020 | "iconv-lite": "^0.4.4", 1021 | "sax": "^1.2.4" 1022 | } 1023 | }, 1024 | "node-pre-gyp": { 1025 | "version": "0.11.0", 1026 | "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz", 1027 | "integrity": "sha512-TwWAOZb0j7e9eGaf9esRx3ZcLaE5tQ2lvYy1pb5IAaG1a2e2Kv5Lms1Y4hpj+ciXJRofIxxlt5haeQ/2ANeE0Q==", 1028 | "dev": true, 1029 | "requires": { 1030 | "detect-libc": "^1.0.2", 1031 | "mkdirp": "^0.5.1", 1032 | "needle": "^2.2.1", 1033 | "nopt": "^4.0.1", 1034 | "npm-packlist": "^1.1.6", 1035 | "npmlog": "^4.0.2", 1036 | "rc": "^1.2.7", 1037 | "rimraf": "^2.6.1", 1038 | "semver": "^5.3.0", 1039 | "tar": "^4" 1040 | } 1041 | }, 1042 | "nopt": { 1043 | "version": "4.0.1", 1044 | "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", 1045 | "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", 1046 | "dev": true, 1047 | "requires": { 1048 | "abbrev": "1", 1049 | "osenv": "^0.1.4" 1050 | } 1051 | }, 1052 | "npm-bundled": { 1053 | "version": "1.0.6", 1054 | "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.6.tgz", 1055 | "integrity": "sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==", 1056 | "dev": true 1057 | }, 1058 | "npm-packlist": { 1059 | "version": "1.4.1", 1060 | "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.1.tgz", 1061 | "integrity": "sha512-+TcdO7HJJ8peiiYhvPxsEDhF3PJFGUGRcFsGve3vxvxdcpO2Z4Z7rkosRM0kWj6LfbK/P0gu3dzk5RU1ffvFcw==", 1062 | "dev": true, 1063 | "requires": { 1064 | "ignore-walk": "^3.0.1", 1065 | "npm-bundled": "^1.0.1" 1066 | } 1067 | }, 1068 | "npm-run-path": { 1069 | "version": "2.0.2", 1070 | "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", 1071 | "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", 1072 | "dev": true, 1073 | "requires": { 1074 | "path-key": "^2.0.0" 1075 | } 1076 | }, 1077 | "npmlog": { 1078 | "version": "4.1.2", 1079 | "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", 1080 | "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", 1081 | "dev": true, 1082 | "requires": { 1083 | "are-we-there-yet": "~1.1.2", 1084 | "console-control-strings": "~1.1.0", 1085 | "gauge": "~2.7.3", 1086 | "set-blocking": "~2.0.0" 1087 | } 1088 | }, 1089 | "number-is-nan": { 1090 | "version": "1.0.1", 1091 | "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", 1092 | "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", 1093 | "dev": true 1094 | }, 1095 | "object-assign": { 1096 | "version": "4.1.1", 1097 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 1098 | "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", 1099 | "dev": true 1100 | }, 1101 | "once": { 1102 | "version": "1.4.0", 1103 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 1104 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 1105 | "dev": true, 1106 | "requires": { 1107 | "wrappy": "1" 1108 | } 1109 | }, 1110 | "os-homedir": { 1111 | "version": "1.0.2", 1112 | "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", 1113 | "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", 1114 | "dev": true 1115 | }, 1116 | "os-locale": { 1117 | "version": "2.1.0", 1118 | "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", 1119 | "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", 1120 | "dev": true, 1121 | "requires": { 1122 | "execa": "^0.7.0", 1123 | "lcid": "^1.0.0", 1124 | "mem": "^1.1.0" 1125 | } 1126 | }, 1127 | "os-tmpdir": { 1128 | "version": "1.0.2", 1129 | "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", 1130 | "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", 1131 | "dev": true 1132 | }, 1133 | "osenv": { 1134 | "version": "0.1.5", 1135 | "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", 1136 | "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", 1137 | "dev": true, 1138 | "requires": { 1139 | "os-homedir": "^1.0.0", 1140 | "os-tmpdir": "^1.0.0" 1141 | } 1142 | }, 1143 | "p-finally": { 1144 | "version": "1.0.0", 1145 | "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", 1146 | "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", 1147 | "dev": true 1148 | }, 1149 | "p-limit": { 1150 | "version": "1.3.0", 1151 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", 1152 | "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", 1153 | "dev": true, 1154 | "requires": { 1155 | "p-try": "^1.0.0" 1156 | } 1157 | }, 1158 | "p-locate": { 1159 | "version": "2.0.0", 1160 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", 1161 | "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", 1162 | "dev": true, 1163 | "requires": { 1164 | "p-limit": "^1.1.0" 1165 | } 1166 | }, 1167 | "p-try": { 1168 | "version": "1.0.0", 1169 | "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", 1170 | "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", 1171 | "dev": true 1172 | }, 1173 | "parse-asn1": { 1174 | "version": "5.1.1", 1175 | "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", 1176 | "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", 1177 | "requires": { 1178 | "asn1.js": "^4.0.0", 1179 | "browserify-aes": "^1.0.0", 1180 | "create-hash": "^1.1.0", 1181 | "evp_bytestokey": "^1.0.0", 1182 | "pbkdf2": "^3.0.3" 1183 | } 1184 | }, 1185 | "path-exists": { 1186 | "version": "3.0.0", 1187 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", 1188 | "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", 1189 | "dev": true 1190 | }, 1191 | "path-is-absolute": { 1192 | "version": "1.0.1", 1193 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 1194 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", 1195 | "dev": true 1196 | }, 1197 | "path-key": { 1198 | "version": "2.0.1", 1199 | "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", 1200 | "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", 1201 | "dev": true 1202 | }, 1203 | "pathval": { 1204 | "version": "1.1.0", 1205 | "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", 1206 | "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", 1207 | "dev": true 1208 | }, 1209 | "pbkdf2": { 1210 | "version": "3.0.17", 1211 | "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", 1212 | "integrity": "sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA==", 1213 | "requires": { 1214 | "create-hash": "^1.1.2", 1215 | "create-hmac": "^1.1.4", 1216 | "ripemd160": "^2.0.1", 1217 | "safe-buffer": "^5.0.1", 1218 | "sha.js": "^2.4.8" 1219 | } 1220 | }, 1221 | "process-nextick-args": { 1222 | "version": "2.0.0", 1223 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", 1224 | "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", 1225 | "dev": true 1226 | }, 1227 | "prs-lib": { 1228 | "version": "0.0.8", 1229 | "resolved": "https://registry.npmjs.org/prs-lib/-/prs-lib-0.0.8.tgz", 1230 | "integrity": "sha512-5Zm+ghXxcn3THcleclrvASMKMDMgySROq4RotSF4p8W0hXBJfb/v5qISkHUqc12jWkwjDY2D2U+5nk7CoMsxPA==", 1231 | "requires": { 1232 | "prs-utility": "0.0.3", 1233 | "superagent": "^4.1.0" 1234 | } 1235 | }, 1236 | "prs-utility": { 1237 | "version": "0.0.3", 1238 | "resolved": "https://registry.npmjs.org/prs-utility/-/prs-utility-0.0.3.tgz", 1239 | "integrity": "sha512-P1B9PrSiDUF13RGoD4FnZI8GVnE+atglhPOKmpchNzrxCgkyiWrhwJxTDxW43eiJJ9/Z7axeAfqf9l+mKwnLiQ==", 1240 | "requires": { 1241 | "ethereumjs-util": "^5.1.3", 1242 | "js-sha3": "^0.7.0", 1243 | "keythereum": "^1.0.2", 1244 | "md5": "^2.2.1", 1245 | "qs": "^6.6.0", 1246 | "secp256k1": "^3.5.0" 1247 | } 1248 | }, 1249 | "pseudomap": { 1250 | "version": "1.0.2", 1251 | "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", 1252 | "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", 1253 | "dev": true 1254 | }, 1255 | "public-encrypt": { 1256 | "version": "4.0.3", 1257 | "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", 1258 | "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", 1259 | "requires": { 1260 | "bn.js": "^4.1.0", 1261 | "browserify-rsa": "^4.0.0", 1262 | "create-hash": "^1.1.0", 1263 | "parse-asn1": "^5.0.0", 1264 | "randombytes": "^2.0.1", 1265 | "safe-buffer": "^5.1.2" 1266 | } 1267 | }, 1268 | "qs": { 1269 | "version": "6.6.0", 1270 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.6.0.tgz", 1271 | "integrity": "sha512-KIJqT9jQJDQx5h5uAVPimw6yVg2SekOKu959OCtktD3FjzbpvaPr8i4zzg07DOMz+igA4W/aNM7OV8H37pFYfA==" 1272 | }, 1273 | "randombytes": { 1274 | "version": "2.0.6", 1275 | "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz", 1276 | "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", 1277 | "requires": { 1278 | "safe-buffer": "^5.1.0" 1279 | } 1280 | }, 1281 | "randomfill": { 1282 | "version": "1.0.4", 1283 | "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", 1284 | "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", 1285 | "requires": { 1286 | "randombytes": "^2.0.5", 1287 | "safe-buffer": "^5.1.0" 1288 | } 1289 | }, 1290 | "rc": { 1291 | "version": "1.2.8", 1292 | "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", 1293 | "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", 1294 | "dev": true, 1295 | "requires": { 1296 | "deep-extend": "^0.6.0", 1297 | "ini": "~1.3.0", 1298 | "minimist": "^1.2.0", 1299 | "strip-json-comments": "~2.0.1" 1300 | }, 1301 | "dependencies": { 1302 | "minimist": { 1303 | "version": "1.2.0", 1304 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", 1305 | "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", 1306 | "dev": true 1307 | } 1308 | } 1309 | }, 1310 | "readable-stream": { 1311 | "version": "2.3.6", 1312 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", 1313 | "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", 1314 | "dev": true, 1315 | "requires": { 1316 | "core-util-is": "~1.0.0", 1317 | "inherits": "~2.0.3", 1318 | "isarray": "~1.0.0", 1319 | "process-nextick-args": "~2.0.0", 1320 | "safe-buffer": "~5.1.1", 1321 | "string_decoder": "~1.1.1", 1322 | "util-deprecate": "~1.0.1" 1323 | } 1324 | }, 1325 | "require-directory": { 1326 | "version": "2.1.1", 1327 | "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", 1328 | "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", 1329 | "dev": true 1330 | }, 1331 | "require-main-filename": { 1332 | "version": "1.0.1", 1333 | "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", 1334 | "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", 1335 | "dev": true 1336 | }, 1337 | "rimraf": { 1338 | "version": "2.6.3", 1339 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", 1340 | "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", 1341 | "dev": true, 1342 | "requires": { 1343 | "glob": "^7.1.3" 1344 | } 1345 | }, 1346 | "ripemd160": { 1347 | "version": "2.0.2", 1348 | "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", 1349 | "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", 1350 | "requires": { 1351 | "hash-base": "^3.0.0", 1352 | "inherits": "^2.0.1" 1353 | } 1354 | }, 1355 | "rlp": { 1356 | "version": "2.2.1", 1357 | "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.1.tgz", 1358 | "integrity": "sha512-nqB/qy+YjXdp/zj1CjCiDwfLMBPv/XFDol0ir/7O/+Ix90++rvi+QoK1CDJcn8JoqCu2WrPPeRucu4qyIDzALg==", 1359 | "requires": { 1360 | "safe-buffer": "^5.1.1" 1361 | } 1362 | }, 1363 | "safe-buffer": { 1364 | "version": "5.1.2", 1365 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 1366 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 1367 | }, 1368 | "safer-buffer": { 1369 | "version": "2.1.2", 1370 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 1371 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", 1372 | "dev": true 1373 | }, 1374 | "sax": { 1375 | "version": "1.2.4", 1376 | "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", 1377 | "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", 1378 | "dev": true 1379 | }, 1380 | "scrypt": { 1381 | "version": "6.0.3", 1382 | "resolved": "https://registry.npmjs.org/scrypt/-/scrypt-6.0.3.tgz", 1383 | "integrity": "sha1-BOAUpWgrU/pQwtXM4WfXGcBthw0=", 1384 | "requires": { 1385 | "nan": "^2.0.8" 1386 | } 1387 | }, 1388 | "secp256k1": { 1389 | "version": "3.6.2", 1390 | "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.6.2.tgz", 1391 | "integrity": "sha512-90nYt7yb0LmI4A2jJs1grglkTAXrBwxYAjP9bpeKjvJKOjG2fOeH/YI/lchDMIvjrOasd5QXwvV2jwN168xNng==", 1392 | "requires": { 1393 | "bindings": "^1.2.1", 1394 | "bip66": "^1.1.3", 1395 | "bn.js": "^4.11.3", 1396 | "create-hash": "^1.1.2", 1397 | "drbg.js": "^1.0.1", 1398 | "elliptic": "^6.2.3", 1399 | "nan": "^2.2.1", 1400 | "safe-buffer": "^5.1.0" 1401 | } 1402 | }, 1403 | "semver": { 1404 | "version": "5.6.0", 1405 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", 1406 | "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", 1407 | "dev": true 1408 | }, 1409 | "set-blocking": { 1410 | "version": "2.0.0", 1411 | "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", 1412 | "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", 1413 | "dev": true 1414 | }, 1415 | "sha.js": { 1416 | "version": "2.4.11", 1417 | "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", 1418 | "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", 1419 | "requires": { 1420 | "inherits": "^2.0.1", 1421 | "safe-buffer": "^5.0.1" 1422 | } 1423 | }, 1424 | "shebang-command": { 1425 | "version": "1.2.0", 1426 | "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", 1427 | "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", 1428 | "dev": true, 1429 | "requires": { 1430 | "shebang-regex": "^1.0.0" 1431 | } 1432 | }, 1433 | "shebang-regex": { 1434 | "version": "1.0.0", 1435 | "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", 1436 | "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", 1437 | "dev": true 1438 | }, 1439 | "signal-exit": { 1440 | "version": "3.0.2", 1441 | "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", 1442 | "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", 1443 | "dev": true 1444 | }, 1445 | "sjcl": { 1446 | "version": "1.0.6", 1447 | "resolved": "https://registry.npmjs.org/sjcl/-/sjcl-1.0.6.tgz", 1448 | "integrity": "sha1-ZBVGKmPMDUIVxJuuydP6DBtTUg8=" 1449 | }, 1450 | "string-width": { 1451 | "version": "1.0.2", 1452 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", 1453 | "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", 1454 | "dev": true, 1455 | "requires": { 1456 | "code-point-at": "^1.0.0", 1457 | "is-fullwidth-code-point": "^1.0.0", 1458 | "strip-ansi": "^3.0.0" 1459 | } 1460 | }, 1461 | "string_decoder": { 1462 | "version": "1.1.1", 1463 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 1464 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 1465 | "requires": { 1466 | "safe-buffer": "~5.1.0" 1467 | } 1468 | }, 1469 | "strip-ansi": { 1470 | "version": "3.0.1", 1471 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", 1472 | "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", 1473 | "dev": true, 1474 | "requires": { 1475 | "ansi-regex": "^2.0.0" 1476 | } 1477 | }, 1478 | "strip-eof": { 1479 | "version": "1.0.0", 1480 | "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", 1481 | "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", 1482 | "dev": true 1483 | }, 1484 | "strip-hex-prefix": { 1485 | "version": "1.0.0", 1486 | "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", 1487 | "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", 1488 | "requires": { 1489 | "is-hex-prefixed": "1.0.0" 1490 | } 1491 | }, 1492 | "strip-json-comments": { 1493 | "version": "2.0.1", 1494 | "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", 1495 | "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", 1496 | "dev": true 1497 | }, 1498 | "superagent": { 1499 | "version": "4.1.0", 1500 | "resolved": "https://registry.npmjs.org/superagent/-/superagent-4.1.0.tgz", 1501 | "integrity": "sha512-FT3QLMasz0YyCd4uIi5HNe+3t/onxMyEho7C3PSqmti3Twgy2rXT4fmkTz6wRL6bTF4uzPcfkUCa8u4JWHw8Ag==", 1502 | "requires": { 1503 | "component-emitter": "^1.2.0", 1504 | "cookiejar": "^2.1.2", 1505 | "debug": "^4.1.0", 1506 | "form-data": "^2.3.3", 1507 | "formidable": "^1.2.0", 1508 | "methods": "^1.1.1", 1509 | "mime": "^2.4.0", 1510 | "qs": "^6.6.0", 1511 | "readable-stream": "^3.0.6" 1512 | }, 1513 | "dependencies": { 1514 | "debug": { 1515 | "version": "4.1.1", 1516 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", 1517 | "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", 1518 | "requires": { 1519 | "ms": "^2.1.1" 1520 | } 1521 | }, 1522 | "ms": { 1523 | "version": "2.1.1", 1524 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", 1525 | "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" 1526 | }, 1527 | "readable-stream": { 1528 | "version": "3.1.1", 1529 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.1.1.tgz", 1530 | "integrity": "sha512-DkN66hPyqDhnIQ6Jcsvx9bFjhw214O4poMBcIMgPVpQvNy9a0e0Uhg5SqySyDKAmUlwt8LonTBz1ezOnM8pUdA==", 1531 | "requires": { 1532 | "inherits": "^2.0.3", 1533 | "string_decoder": "^1.1.1", 1534 | "util-deprecate": "^1.0.1" 1535 | } 1536 | } 1537 | } 1538 | }, 1539 | "supertest": { 1540 | "version": "3.4.2", 1541 | "resolved": "https://registry.npmjs.org/supertest/-/supertest-3.4.2.tgz", 1542 | "integrity": "sha512-WZWbwceHUo2P36RoEIdXvmqfs47idNNZjCuJOqDz6rvtkk8ym56aU5oglORCpPeXGxT7l9rkJ41+O1lffQXYSA==", 1543 | "dev": true, 1544 | "requires": { 1545 | "methods": "^1.1.2", 1546 | "superagent": "^3.8.3" 1547 | }, 1548 | "dependencies": { 1549 | "debug": { 1550 | "version": "3.2.6", 1551 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", 1552 | "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", 1553 | "dev": true, 1554 | "requires": { 1555 | "ms": "^2.1.1" 1556 | } 1557 | }, 1558 | "mime": { 1559 | "version": "1.6.0", 1560 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 1561 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", 1562 | "dev": true 1563 | }, 1564 | "ms": { 1565 | "version": "2.1.1", 1566 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", 1567 | "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", 1568 | "dev": true 1569 | }, 1570 | "superagent": { 1571 | "version": "3.8.3", 1572 | "resolved": "https://registry.npmjs.org/superagent/-/superagent-3.8.3.tgz", 1573 | "integrity": "sha512-GLQtLMCoEIK4eDv6OGtkOoSMt3D+oq0y3dsxMuYuDvaNUvuT8eFBuLmfR0iYYzHC1e8hpzC6ZsxbuP6DIalMFA==", 1574 | "dev": true, 1575 | "requires": { 1576 | "component-emitter": "^1.2.0", 1577 | "cookiejar": "^2.1.0", 1578 | "debug": "^3.1.0", 1579 | "extend": "^3.0.0", 1580 | "form-data": "^2.3.1", 1581 | "formidable": "^1.2.0", 1582 | "methods": "^1.1.1", 1583 | "mime": "^1.4.1", 1584 | "qs": "^6.5.1", 1585 | "readable-stream": "^2.3.5" 1586 | } 1587 | } 1588 | } 1589 | }, 1590 | "supports-color": { 1591 | "version": "5.4.0", 1592 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", 1593 | "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", 1594 | "dev": true, 1595 | "requires": { 1596 | "has-flag": "^3.0.0" 1597 | } 1598 | }, 1599 | "tar": { 1600 | "version": "4.4.8", 1601 | "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.8.tgz", 1602 | "integrity": "sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ==", 1603 | "dev": true, 1604 | "requires": { 1605 | "chownr": "^1.1.1", 1606 | "fs-minipass": "^1.2.5", 1607 | "minipass": "^2.3.4", 1608 | "minizlib": "^1.1.1", 1609 | "mkdirp": "^0.5.0", 1610 | "safe-buffer": "^5.1.2", 1611 | "yallist": "^3.0.2" 1612 | } 1613 | }, 1614 | "type-detect": { 1615 | "version": "4.0.8", 1616 | "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", 1617 | "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", 1618 | "dev": true 1619 | }, 1620 | "util-deprecate": { 1621 | "version": "1.0.2", 1622 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 1623 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" 1624 | }, 1625 | "uuid": { 1626 | "version": "3.0.0", 1627 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.0.tgz", 1628 | "integrity": "sha1-Zyj8BFnEUNeWqZwxg3VpvfZy1yg=" 1629 | }, 1630 | "which": { 1631 | "version": "1.3.1", 1632 | "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", 1633 | "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", 1634 | "dev": true, 1635 | "requires": { 1636 | "isexe": "^2.0.0" 1637 | } 1638 | }, 1639 | "which-module": { 1640 | "version": "2.0.0", 1641 | "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", 1642 | "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", 1643 | "dev": true 1644 | }, 1645 | "wide-align": { 1646 | "version": "1.1.3", 1647 | "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", 1648 | "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", 1649 | "dev": true, 1650 | "requires": { 1651 | "string-width": "^1.0.2 || 2" 1652 | } 1653 | }, 1654 | "wrap-ansi": { 1655 | "version": "2.1.0", 1656 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", 1657 | "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", 1658 | "dev": true, 1659 | "requires": { 1660 | "string-width": "^1.0.1", 1661 | "strip-ansi": "^3.0.1" 1662 | } 1663 | }, 1664 | "wrappy": { 1665 | "version": "1.0.2", 1666 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 1667 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", 1668 | "dev": true 1669 | }, 1670 | "y18n": { 1671 | "version": "3.2.1", 1672 | "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", 1673 | "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", 1674 | "dev": true 1675 | }, 1676 | "yallist": { 1677 | "version": "3.0.3", 1678 | "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", 1679 | "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", 1680 | "dev": true 1681 | }, 1682 | "yargs": { 1683 | "version": "11.1.0", 1684 | "resolved": "https://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz", 1685 | "integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==", 1686 | "dev": true, 1687 | "requires": { 1688 | "cliui": "^4.0.0", 1689 | "decamelize": "^1.1.1", 1690 | "find-up": "^2.1.0", 1691 | "get-caller-file": "^1.0.1", 1692 | "os-locale": "^2.0.0", 1693 | "require-directory": "^2.1.1", 1694 | "require-main-filename": "^1.0.1", 1695 | "set-blocking": "^2.0.0", 1696 | "string-width": "^2.0.0", 1697 | "which-module": "^2.0.0", 1698 | "y18n": "^3.2.1", 1699 | "yargs-parser": "^9.0.2" 1700 | }, 1701 | "dependencies": { 1702 | "ansi-regex": { 1703 | "version": "3.0.0", 1704 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", 1705 | "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", 1706 | "dev": true 1707 | }, 1708 | "is-fullwidth-code-point": { 1709 | "version": "2.0.0", 1710 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", 1711 | "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", 1712 | "dev": true 1713 | }, 1714 | "string-width": { 1715 | "version": "2.1.1", 1716 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", 1717 | "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", 1718 | "dev": true, 1719 | "requires": { 1720 | "is-fullwidth-code-point": "^2.0.0", 1721 | "strip-ansi": "^4.0.0" 1722 | } 1723 | }, 1724 | "strip-ansi": { 1725 | "version": "4.0.0", 1726 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", 1727 | "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", 1728 | "dev": true, 1729 | "requires": { 1730 | "ansi-regex": "^3.0.0" 1731 | } 1732 | } 1733 | } 1734 | }, 1735 | "yargs-parser": { 1736 | "version": "9.0.2", 1737 | "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-9.0.2.tgz", 1738 | "integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=", 1739 | "dev": true, 1740 | "requires": { 1741 | "camelcase": "^4.1.0" 1742 | } 1743 | } 1744 | } 1745 | } 1746 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prs-sdk", 3 | "description": "Social Identity / Publish System based on Blockchain.", 4 | "version": "0.0.5", 5 | "homepage": "https://press.one", 6 | "main": "./lib/index.js", 7 | "author": "PRESS.one", 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/Press-One/Third-Party-APP-SDK.git" 11 | }, 12 | "scripts": { 13 | "start": "node test" 14 | }, 15 | "dependencies": { 16 | "ethereumjs-util": "^5.1.3", 17 | "js-sha3": "^0.7.0", 18 | "keythereum": "^1.0.2", 19 | "md5": "^2.2.1", 20 | "prs-lib": "0.0.8", 21 | "prs-utility": "0.0.3", 22 | "qs": "^6.6.0", 23 | "secp256k1": "^3.6.2", 24 | "superagent": "^4.1.0" 25 | }, 26 | "devDependencies": { 27 | "canvas": "^2.3.1", 28 | "chai": "^4.1.2", 29 | "mocha": "^5.0.2", 30 | "supertest": "^3.4.2", 31 | "yargs": "^11.0.0" 32 | }, 33 | "license": "MIT" 34 | } 35 | -------------------------------------------------------------------------------- /samples/README.md: -------------------------------------------------------------------------------- 1 | # 示例 2 | 3 | ## 目录 4 | 5 | - [dapp 相关](./app.example.js) 6 | - [区块信息相关](./block.example.js) 7 | - [合约相关](./contract.example.js) 8 | - [草稿相关](./draft.example.js) 9 | - [文件签名相关](./file.example.js) 10 | - [钱包相关](./finance.example.js) 11 | - [订单相关](./order.example.js) 12 | - [订阅相关](./subscription.exmaple.js) 13 | - [用户相关](./user.example.js) 14 | - [工具函数](./util.example.js) 15 | - [综合例子](./demo.js) 16 | -------------------------------------------------------------------------------- /samples/app.example.js: -------------------------------------------------------------------------------- 1 | // 用例演示了以下步骤: 2 | // - 用户创建 dapp 3 | // - 用户自己向刚刚创建的 dapp 授权,获取 code(dapp 可以利用 code 换取 token, 有了 token, dapp 就可以代表用户身份进行操作),实际开发中通常由 dapp 引导用户访问授权页面,然后以重定向回调的形式返回 code。 4 | // - 使用 dapp 身份以及用户的授权 code 获取 token 5 | // - 用户给自己的 dapp 修改信息 6 | // - 用户解除自己对 dapp 的授权 7 | // - 用户删除刚创建的 dapp 8 | 9 | const PRS = require('prs-lib') 10 | const prsUtils = require('prs-utility') 11 | const testConfig = require('../fixtures') 12 | 13 | async function appExample () { 14 | // GET configuration 15 | const keystore = testConfig.developer.keystore 16 | const passwrd = testConfig.developer.password 17 | const address = testConfig.developer.address 18 | 19 | const privateKey = prsUtils.recoverPrivateKey(keystore, passwrd) 20 | 21 | const prs = new PRS({ 22 | env: 'env', debug: true, privateKey, address 23 | }) 24 | 25 | const dapp = { 26 | description: 'This is a testing app.', 27 | url: 'https://yourapp.com', 28 | redirectUrl: 'https://yourapp.com/auth' 29 | } 30 | const name = 'test dapp' + Date.now() 31 | const nameAvailable = await prs.dapp.isNameExist(name) 32 | .then(res => res.body) 33 | .then(data => data.isExist === false) 34 | if (nameAvailable) { 35 | const createRes = await prs.dapp.create({ ...dapp, name }) 36 | .then(res => res.body) 37 | console.log(createRes) 38 | 39 | const dappRes = await prs.dapp.getByAddress(createRes.address).then(res => res.body) 40 | console.log(dappRes) 41 | 42 | // 引导用户使用浏览器访问,进行授权 43 | const authorizeUrl = prs.dapp.getAuthorizeUrl(createRes.address) 44 | console.log(authorizeUrl) 45 | 46 | // 这里的例子是自己向刚刚创建的 dapp 授权,实际可以传入其他 dapp 的地址进行授权 47 | const webAuthRes = await prs.dapp.webAuthorize(createRes.address).then(res => res.body) 48 | console.log(webAuthRes) 49 | 50 | // 这里需要使用 dapp 的身份进行操作 51 | const dappClient = new PRS({ 52 | env: 'env', debug: true, privateKey: dappRes.privateKey, address: createRes.address 53 | }) 54 | const authRes = await dappClient.dapp.authByCode(webAuthRes.code, createRes.address, dappClient.config.privateKey).then(res => res.body) 55 | console.log(authRes) 56 | 57 | const updatedRes = await prs.dapp.update(createRes.address, { ...dapp, name }) 58 | .then(res => res.body) 59 | console.log(updatedRes) 60 | 61 | // 解除授权 62 | const deAuthRes = await prs.dapp.deauthenticate(dappClient.config.address, authRes.appAuthentication.authAddress).then(res => res.body) 63 | console.log(deAuthRes) 64 | 65 | const deleteRes = await prs.dapp.delete(createRes.address) 66 | .then(res => res.body) 67 | console.log(deleteRes) 68 | } 69 | } 70 | 71 | appExample().then(console.log).catch(console.error) 72 | -------------------------------------------------------------------------------- /samples/assets/test.md: -------------------------------------------------------------------------------- 1 | # test markdown file 2 | 3 | content -------------------------------------------------------------------------------- /samples/block.example.js: -------------------------------------------------------------------------------- 1 | // 用例演示了如何通过 block id 获取 block 数据 2 | 3 | const PRS = require('prs-lib') 4 | 5 | async function blockExample () { 6 | const client = new PRS({ env: 'env', debug: true }) 7 | const blockIds = ['ba03bd584d69b89615ce8db22b4c593342a5ec09b343a7859044a8e4d389c4c2', '65163724a98d29506b1031dc68fa62fb5a7a11fe631fb723a723b2a19e9bb65c'] 8 | 9 | const withDetail = true 10 | // 批量获取指定 rId 的区块数据 11 | const res = await client.block.getByRIds(blockIds, { withDetail }) 12 | console.log(res.body) 13 | } 14 | 15 | blockExample().then(console.log).catch(console.error) 16 | -------------------------------------------------------------------------------- /samples/contract.example.js: -------------------------------------------------------------------------------- 1 | // 以下用例演示了 2 | // - 如何获取合约模版 3 | // - 如何创建合约 4 | // - 如何绑定合约 5 | // - 如何查询合约 6 | 7 | const PRS = require('prs-lib') 8 | const prsUtils = require('prs-utility') 9 | const testConfig = require('../fixtures') 10 | 11 | async function contractExample () { 12 | // GET configuration 13 | const keystore = testConfig.developer.keystore 14 | const passwrd = testConfig.developer.password 15 | const address = testConfig.developer.address 16 | 17 | const privateKey = prsUtils.recoverPrivateKey(keystore, passwrd) 18 | 19 | const prs = new PRS({ 20 | env: 'env', debug: true, privateKey, address 21 | }) 22 | 23 | // 获取合约模板 24 | const templatesRes = await prs.contract.getTemplates() 25 | console.log(templatesRes.body.list[0].licenses) 26 | 27 | // 创建合约 28 | const contractCode = `PRSC Ver 0.1 29 | Name 购买授权 30 | Desc 这是一个\\n测试合约 31 | Receiver ${address} 32 | License usage1 CNB:0.001 Terms: 这是个人使用条款,禁止\\n商业应用。 33 | License usage2 CNB:0.002 Terms: 这是商业使用条款,允许\\n修改和复制。` 34 | const contractRes = await prs.contract.create(contractCode) 35 | console.log(contractRes.body) 36 | const contractRId = contractRes.body.contract.rId 37 | 38 | // 这里新签名一个文件 39 | const now = Date.now().toString() 40 | const signBufferRes = await prs.file.signByBuffer( 41 | { 42 | buffer: Buffer.from(now + 'buffer'), 43 | filename: `test buffer ${now}.md`, 44 | title: `test buffer title ${now}` 45 | } 46 | ).then(res => res.body) 47 | const fileRId = signBufferRes.cache.rId 48 | 49 | // 绑定该合约 50 | const bindRes = await prs.contract.bind({ 51 | contractRId, fileRId, beneficiaryAddress: address 52 | }) 53 | console.log(bindRes.body) 54 | 55 | // 查询合约 56 | const getContractRes = await prs.contract.getByRId(contractRId) 57 | console.log(getContractRes.body) 58 | 59 | // 查询所有合约 60 | const getContractsRes = await prs.contract.getContracts({ offset: 0, limit: 1 }) 61 | console.log(getContractsRes.body) 62 | } 63 | 64 | contractExample().catch(console.error) 65 | -------------------------------------------------------------------------------- /samples/demo.js: -------------------------------------------------------------------------------- 1 | // 以下是一个综合实例 2 | // 演示了一个 dapp 如何获取用户授权,然后代表用户进行文件签名、合约绑定操作 3 | // 接着模拟另一个用户对合约进行购买 4 | 5 | const utility = require('prs-utility') 6 | const PRS = require('prs-lib') 7 | 8 | const fs = require('fs') 9 | const path = require('path') 10 | 11 | async function demo () { 12 | try { 13 | // 1. 开发者前往 PRS 网站,创建 DApp,获取到对应的 address 和 privateKey。 14 | const appAddress = '7483f699284b55eb585b229c0ccee1f46fb893a8' 15 | const appPrivateKey = '7552f60cdce1859e45e9ba3ec4b677c883a1016187c82415b2ffc45708e69670' 16 | 17 | // 2. 开发者获取到授权页面,引导用户跳转到该页面进行授权。 18 | const client1 = new PRS({ env: 'env', debug: true }) 19 | const webAuthorizeUrl = client1.dapp.getAuthorizeUrl(appAddress) 20 | console.log('webAuthorizeUrl: ' + webAuthorizeUrl) 21 | 22 | // 3. 用户跳转至 webAuthorizeUrl 后,会显示[确认授权]按钮,如果用户点击[确定授权],页面会回调至 `REDIRECT_URL/?code=CODE`,此时就能通过 query string 拿到返回的 code。 23 | // const code = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTMxNzc5NTcsImp0aSI6Ijg4MjQ3NDMzLWMxOTctNDFmMS04NTFlLTNmZDAwZWQzMWZkYSIsImRhdGEiOnsidXNlckFkZHJlc3MiOiJhZDMzNDc4NjdlNzBmNjRiYWY1ZDBjMzg4ZjIzYjQxOGNhMTA1Y2E1IiwiYXBwQWRkcmVzcyI6Ijc0ODNmNjk5Mjg0YjU1ZWI1ODViMjI5YzBjY2VlMWY0NmZiODkzYTgiLCJ0eXBlIjoiZW1haWwiLCJhdXRoQWRkcmVzcyI6IjU4NmE3OTdlZjhmZjQzNjJlMTY3MWZlYTM2ZGZhM2Y0MzFkMDcyMmMifSwicHJvdmlkZXIiOiJwcmVzc29uZSIsImV4cCI6MTU1MzQzNzE1N30.GyaPCApA8oR6PIV2ZoHG7gTwKf7x5JpqaqdzYHZtsMU'; 24 | // 模拟用户跳转至授权页面,点击[确定授权]按钮的操作。 25 | const code = await mockWebAuthorize(appAddress) 26 | console.log(code) 27 | 28 | // 4. 拿到 code 之后,开发者使用 appPrivateKey 调用接口换取 access token。 29 | const res1 = await client1.dapp.authByCode(code, appAddress, appPrivateKey) 30 | const token = res1.body.token 31 | const authAddress = res1.body.appAuthentication.authAddress 32 | console.log('token: ' + token) 33 | console.log('authAddress: ' + authAddress) 34 | 35 | // 5. 获取到 access token 之后即可签名文件。 36 | // 需要签名的文件,签名文件的内容不可重复。 37 | const markdownFile = `../${String(Date.now())}.md` 38 | const markdownFileUrl = path.join(__dirname, markdownFile) 39 | fs.writeFileSync(markdownFileUrl, String(Date.now()), 'utf-8') 40 | 41 | const client2 = new PRS({ env: 'env', debug: true, address: authAddress, token: token }) 42 | const stream = fs.createReadStream(markdownFileUrl) 43 | const data = { stream: stream, filename: 'text.md', title: 'xxx' } 44 | const meta = { uuid: 'xxxx' } 45 | const res2 = await client2.file.signByStream(data, meta) 46 | const fileHash = res2.body.cache.msghash 47 | const fileRId = res2.body.cache.rId 48 | console.log('fileHash: ' + fileHash) 49 | console.log('fileRId: ' + fileRId) 50 | 51 | fs.unlinkSync(markdownFileUrl) 52 | 53 | // 6. 签名成功之后,我们可以为文件绑定合约。 54 | // a. 创建合约。 创建合约需要遵循指定格式,目前收款人必须为创建者本人。具体可参考 DApp 开发者文档。 55 | const contractCode = `PRSC Ver 0.1 56 | Name 购买授权 57 | Desc 这是一个\\n测试合约 58 | Receiver ${authAddress} 59 | License usage1 CNB:0.001 Terms: 这是个人使用条款,禁止\\n商业应用。 60 | License usage2 CNB:0.002 Terms: 这是商业使用条款,允许\\n修改和复制。` 61 | const contractRes = await client2.contract.create(contractCode) 62 | const contractRId = contractRes.body.contract.rId 63 | console.log('contractRId: ' + contractRId) 64 | 65 | // b. 绑定合约。 66 | const bindRes = await client2.contract.bind(contractRId, fileRId, authAddress) 67 | console.log(bindRes.body) 68 | 69 | // 7. 合约绑定之后,其他用户就可以购买合约。 70 | const buyerPrivateKey = utility.recoverPrivateKey('{"address":"27d64b3524ef5679c4d7c3493088c70478a700db","crypto":{"cipher":"aes-128-ctr","ciphertext":"100bca558b3fbc5b7c821c896c7afbd1b69967f52c09749814e5d17a3dbddf71","cipherparams":{"iv":"229453d4b39da3c77a62233ae93a5173"},"mac":"31120657efc145c2198223de03d5bc68640204dd1b7d99f8f9c0c2723c843c1c","kdf":"pbkdf2","kdfparams":{"c":262144,"dklen":32,"prf":"hmac-sha256","salt":"ceae264708217faa7420e2b2a8aea8f55f04d96f2956d450c509c1fd823cb417"}},"id":"e52f066d-ee58-4b09-bb50-4de75f703f27","version":3}', 'nopassword') 71 | const buyerAddress = '27d64b3524ef5679c4d7c3493088c70478a700db' 72 | 73 | // 初始化 client 74 | const client3 = new PRS({ env: 'env', debug: true, address: buyerAddress, privateKey: buyerPrivateKey }) 75 | 76 | const buyRes = client3.contract.createOrder(contractRId, fileRId, 'usage1') 77 | console.log(buyRes.body) 78 | } catch (err) { 79 | console.log(err) 80 | } 81 | } 82 | demo() 83 | 84 | async function mockWebAuthorize (appAddress) { 85 | try { 86 | const userPrivateKey = utility.recoverPrivateKey('{"address":"758ea2601697fbd3ba6eb6774ed70b6c4cdb0ef9","crypto":{"cipher":"aes-128-ctr","ciphertext":"92af6f6710eba271eae5ac7fec72c70d9f49215e7880a0c45d4c53e56bd7ea59","cipherparams":{"iv":"13ddf95d970e924c97e4dcd29ba96520"},"mac":"b9d81d78f067334ee922fb2863e32c14cbc46e479eeb0acc11fb31e39256004e","kdf":"pbkdf2","kdfparams":{"c":262144,"dklen":32,"prf":"hmac-sha256","salt":"79f90bb603491573e40a79fe356b88d0c7869852e43c2bbaabed44578a82bbfa"}},"id":"93028e51-a2a4-4514-bc1a-94b089445f35","version":3}', '123123') 87 | const userAddress = '758ea2601697fbd3ba6eb6774ed70b6c4cdb0ef9' 88 | const client = new PRS({ env: 'env', debug: true, privateKey: userPrivateKey, address: userAddress }) 89 | const res = await client.dapp.webAuthorize(appAddress) 90 | const code = res.body.code 91 | // const redirectUrl = res.body.redirectUrl 92 | return code 93 | } catch (err) { 94 | console.log(err) 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /samples/draft.example.js: -------------------------------------------------------------------------------- 1 | // 以下实例演示了草稿的基本操作 2 | // - 创建草稿 3 | // - 更新草稿 4 | // - 获取草稿 5 | // - 删除草稿 6 | 7 | const PRS = require('prs-lib') 8 | const prsUtils = require('prs-utility') 9 | const testConfig = require('../fixtures') 10 | 11 | async function draftDemo () { 12 | const keystore = testConfig.developer.keystore 13 | const passwrd = testConfig.developer.password 14 | const address = testConfig.developer.address 15 | 16 | const privateKey = prsUtils.recoverPrivateKey(keystore, passwrd) 17 | 18 | const prs = new PRS({ 19 | env: 'env', debug: true, privateKey, address 20 | }) 21 | 22 | // 目前 PRS 支持创建文本草稿 23 | const draft = { 24 | title: `draft title ${String(Date.now())}`, 25 | content: `draft content ${String(Date.now())}`, 26 | mimeType: 'text/plain' 27 | } 28 | const draftRes = await prs.draft.create(draft) 29 | console.log(draftRes.body) 30 | const draftId = draftRes.body.draftId 31 | 32 | // 根据 id 更新草稿内容 33 | const draftNew = { 34 | title: `draft update title ${String(Date.now())}`, 35 | content: `draft update content ${String(Date.now())}`, 36 | mimeType: 'text/plain' 37 | } 38 | const updateRes = await prs.draft.update(draftId, draftNew) 39 | console.log(updateRes.body) 40 | 41 | // 根据 id 获取草稿 42 | const res = await prs.draft.getById(draftId) 43 | console.log(res.body) 44 | 45 | // 获取所有草稿 46 | const draftsRes = await prs.draft.getDrafts() 47 | console.log(draftsRes.body.data) 48 | 49 | // 删除草稿 50 | const deleteRes = await prs.draft.delete(draftId) 51 | console.log(deleteRes.body) 52 | } 53 | 54 | draftDemo().catch(console.error) 55 | -------------------------------------------------------------------------------- /samples/file.example.js: -------------------------------------------------------------------------------- 1 | // 以下实例主要演示了文件的相关操作 2 | // - 根据签名文件流 3 | // - 签名 buffer 4 | // - 获取文件(根据 hash 和 块id) 5 | // - 获取 feeds 6 | // - 打赏文件 7 | 8 | const PRS = require('prs-lib') 9 | const prsUtils = require('prs-utility') 10 | const { Readable } = require('stream') 11 | const testConfig = require('../fixtures') 12 | 13 | async function fileExample () { 14 | // GET configuration 15 | const keystore = testConfig.developer.keystore 16 | const passwrd = testConfig.developer.password 17 | const address = testConfig.developer.address 18 | 19 | const privateKey = prsUtils.recoverPrivateKey(keystore, passwrd) 20 | 21 | const prs = new PRS({ 22 | env: 'env', debug: true, privateKey, address 23 | }) 24 | 25 | const rStream = new Readable() 26 | const now = Date.now().toString() 27 | rStream.push(Buffer.from(now)) 28 | rStream.push(null) 29 | 30 | const signStreamRes = await prs.file.signByStream( 31 | { 32 | stream: rStream, 33 | filename: `test stream ${now}.md`, // 目前暂时只支持 markdown 文件和图片 34 | title: `test title ${now}` 35 | }, 36 | null // no meta data 37 | ).then(res => res.body) 38 | console.log(signStreamRes) 39 | 40 | const signBufferRes = await prs.file.signByBuffer( 41 | { 42 | buffer: Buffer.from(now + 'buffer'), 43 | filename: `test buffer ${now}.md`, 44 | title: `test buffer title ${now}` 45 | } 46 | ).then(res => res.body) 47 | console.log(signBufferRes) 48 | 49 | const fileByRIdRecord = await prs.file.getByRId(signBufferRes.cache.rId) 50 | .then(res => res.body) 51 | console.log(fileByRIdRecord) 52 | 53 | const fileByMsgHashRecord = await prs.file.getByMsghash(signBufferRes.cache.msghash) 54 | .then(res => res.body) 55 | console.log(fileByMsgHashRecord) 56 | 57 | const files = await prs.file.getFeeds(address, { 58 | limit: 10, 59 | offset: 0 60 | }).then(res => res.body) 61 | console.log(files) 62 | 63 | { 64 | const keystore = testConfig.user.keystore 65 | const passwrd = testConfig.user.password 66 | const address = testConfig.user.address 67 | 68 | const privateKey = prsUtils.recoverPrivateKey(keystore, passwrd) 69 | 70 | // 这里使用 user 的身份,避免自己不能给自己付钱 71 | const prs = new PRS({ 72 | env: 'env', debug: true, privateKey, address 73 | }) 74 | const rewardRes = await prs.file.reward( 75 | signBufferRes.cache.rId, 76 | 0.001, 77 | { 78 | comment: 'test reward' 79 | } 80 | ).then(res => res.body) 81 | console.log(rewardRes) 82 | } 83 | } 84 | 85 | fileExample().then(console.log).catch(console.error) 86 | -------------------------------------------------------------------------------- /samples/finance.example.js: -------------------------------------------------------------------------------- 1 | // 以下代码主要演示了钱包的相关操作 2 | // - 获取钱包 3 | // - 获取交易记录 4 | // - 充值和体现 5 | 6 | const PRS = require('prs-lib') 7 | const prsUtils = require('prs-utility') 8 | const testConfig = require('../fixtures') 9 | 10 | async function financeExample () { 11 | // GET configuration 12 | const keystore = testConfig.user.keystore 13 | const passwrd = testConfig.user.password 14 | const address = testConfig.user.address 15 | 16 | const privateKey = prsUtils.recoverPrivateKey(keystore, passwrd) 17 | 18 | const client = new PRS({ env: 'env', debug: true, address, privateKey }) 19 | 20 | // 获取钱包 21 | const walletRes = await client.finance.getWallet() 22 | console.log(walletRes.body) 23 | 24 | // 获取交易历史记录 25 | const transactionsRes = await client.finance.getTransactions({ offset: 0, limit: 1 }) 26 | console.log(transactionsRes.body) 27 | 28 | const rechargeRes = await client.finance.recharge(1) 29 | console.log(rechargeRes.body) 30 | 31 | const withdrawRes = await client.finance.withdraw(1) 32 | console.log(withdrawRes.body) 33 | } 34 | 35 | financeExample().then(console.log).catch(console.error) 36 | -------------------------------------------------------------------------------- /samples/keystore.example.js: -------------------------------------------------------------------------------- 1 | const PRS = require('prs-lib') 2 | const testConfig = require('../fixtures') 3 | 4 | async function keystoreExample () { 5 | const prs = new PRS({ 6 | env: 'env', debug: true 7 | }) 8 | 9 | const byEmailRes = await prs.keystore.getByEmail(testConfig.developer.email, testConfig.developer.password) 10 | console.log(byEmailRes.body) 11 | } 12 | 13 | keystoreExample().catch(console.error) 14 | -------------------------------------------------------------------------------- /samples/order.example.js: -------------------------------------------------------------------------------- 1 | // 以下代码演示了订单相关 api 2 | // 主要包括 购买合约和查询订单 3 | 4 | const PRS = require('prs-lib') 5 | const prsUtils = require('prs-utility') 6 | const testConfig = require('../fixtures') 7 | 8 | async function orderExample () { 9 | // GET configuration 10 | const keystore = testConfig.user.keystore 11 | const passwrd = testConfig.user.password 12 | const address = testConfig.user.address 13 | 14 | const privateKey = prsUtils.recoverPrivateKey(keystore, passwrd) 15 | 16 | const prs = new PRS({ 17 | env: 'env', debug: true, privateKey, address 18 | }) 19 | 20 | // 创建合约 21 | const contractCode = `PRSC Ver 0.1 22 | Name 购买授权 23 | Desc 这是一个\\n测试合约 24 | Receiver ${address} 25 | License usage1 CNB:0.001 Terms: 这是个人使用条款,禁止\\n商业应用。 26 | License usage2 CNB:0.002 Terms: 这是商业使用条款,允许\\n修改和复制。` 27 | const contractRes = await prs.contract.create(contractCode) 28 | const contractRId = contractRes.body.contract.rId 29 | 30 | // 这里新签名一个文件 31 | const now = Date.now().toString() 32 | const signBufferRes = await prs.file.signByBuffer( 33 | { 34 | buffer: Buffer.from(now + 'buffer'), 35 | filename: `test buffer ${now}.md`, 36 | title: `test buffer title ${now}` 37 | } 38 | ).then(res => res.body) 39 | const fileRId = signBufferRes.cache.rId 40 | 41 | // 绑定该合约 42 | const bindRes = await prs.contract.bind(contractRId, fileRId, address) 43 | console.log(bindRes.body) 44 | 45 | // 其他用户就可以购买合约。 46 | { 47 | const keystore = testConfig.buyer.keystore 48 | const passwrd = testConfig.buyer.password 49 | const address = testConfig.buyer.address 50 | 51 | const privateKey = prsUtils.recoverPrivateKey(keystore, passwrd) 52 | 53 | const prs = new PRS({ 54 | env: 'env', debug: true, privateKey, address 55 | }) 56 | const buyRes = await prs.order.createOrder(contractRId, fileRId, 'usage1') 57 | console.log(buyRes.body) 58 | const orderRId = buyRes.body.rId 59 | 60 | // 获取 contract 相关的订单 61 | const ordersWithContract = await prs.order.getOrdersByContractRId(contractRId, { limit: 1, offset: 0 }) 62 | console.log(ordersWithContract.body) 63 | 64 | // 获取付过钱的订单 65 | const purchasedOrdersRes = await prs.order.getPurchasedOrders({ limit: 1, offset: 0 }) 66 | console.log(purchasedOrdersRes.body.list) 67 | 68 | const orderRes = await prs.order.getOrderByRId(orderRId) 69 | console.log(orderRes.body) 70 | } 71 | } 72 | 73 | orderExample().catch(console.error) 74 | -------------------------------------------------------------------------------- /samples/subscription.exmaple.js: -------------------------------------------------------------------------------- 1 | // 以下代码演示了订阅相关的代码 2 | // 包括: 3 | // - 获取订阅 4 | // - 获取推荐 5 | // - 订阅 6 | // - 取消订阅 7 | 8 | const PRS = require('prs-lib') 9 | const prsUtils = require('prs-utility') 10 | const testConfig = require('../fixtures') 11 | 12 | async function subscriptionExample () { 13 | // GET configuration 14 | const keystore = testConfig.developer.keystore 15 | const passwrd = testConfig.developer.password 16 | const address = testConfig.developer.address 17 | 18 | const privateKey = prsUtils.recoverPrivateKey(keystore, passwrd) 19 | 20 | const prs = new PRS({ 21 | env: 'env', debug: true, privateKey, address 22 | }) 23 | 24 | // 获取订阅信息 25 | const subRes = await prs.subscription.getSubscriptions(address, 0, 1).then(res => res.body) 26 | console.log(subRes) 27 | 28 | // 获取订阅信息(JSON 格式) 29 | const subJSONRes = await prs.subscription.getSubscriptionJson(address, 0, 1).then(res => res.body) 30 | console.log(subJSONRes) 31 | 32 | // 获取订阅者 33 | const subscribers = await prs.subscription.getSubscribers(address, 0, 1).then(res => res.body) 34 | console.log(subscribers) 35 | 36 | // 获取推荐列表 37 | const recommendationRes = await prs.subscription.getRecommendations(0, 1).then(res => res.body) 38 | console.log(recommendationRes) 39 | 40 | // 获取推荐列表(JSON 格式) 41 | const recommendationJSONRes = await prs.subscription.getRecommendationJson(0, 1).then(res => res.body) 42 | console.log(recommendationJSONRes.items) 43 | 44 | // 订阅 45 | const sRes = await prs.subscription.subscribe(testConfig.user.address).then(res => res.body) 46 | console.log(sRes) 47 | 48 | // 检查订阅状态 49 | const checkSubRes = await prs.subscription.checkSubscription(address, testConfig.user.address).then(res => res.body) 50 | console.log(checkSubRes) 51 | 52 | // 取消订阅 53 | const unsubRes = await prs.subscription.unsubscribe(testConfig.user.address).then(res => res.body) 54 | console.log(unsubRes) 55 | } 56 | 57 | subscriptionExample().catch(console.error) 58 | -------------------------------------------------------------------------------- /samples/user.example.js: -------------------------------------------------------------------------------- 1 | // 以下代码展示了 user 的相关用法 2 | // 包括 3 | // - 获取用户信息 4 | // - 修改用户信息 5 | // - 上传头像 6 | 7 | const PRS = require('prs-lib') 8 | const prsUtils = require('prs-utility') 9 | const testConfig = require('../fixtures') 10 | 11 | const avatarStr = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUg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MWWbJ2X1yWbwfYvbZLp9JmfvpJzD9buHzlX372Y37t9W+SmDqBvfSp2KuzgUbQ0Hv90nnily9Q/fwOofE0+84Bd6p7pG7vMpOdVLyWySiKv3TuLIXCpLJEVLPt1uZhSQum7SZht1Nq6VWwCRMuTBC7lNcJ4IhEdhPLXl/n+a+/SrlYxK0L3JdfJrf7GKfOCTfe+jcu+n+LC/PP8O5BDftAleTj9MfHuLWzRJQOofOnGf7v6CQkxmsSOq2SrFscqtTIKSkFM2MEdF7oj0YomsLMqOXJLczWm7Trpg6n3/3z4dd++1u8++N3GN7dIWAq37UbRAVtudRi5TfnOHFimqSi+/0bX/LMiy9xYPTY/NnH+FaL+Hryg3JDB5QofgUWo6bFqk05qVsnph6H/gG29CSkvNmRTPtdDkxxYSw4TTCW5P8AnUhPxPqUg6kAAAAASUVORK5CYII=' 12 | 13 | async function userExample () { 14 | // GET configuration 15 | const keystore = testConfig.developer.keystore 16 | const passwrd = testConfig.developer.password 17 | const address = testConfig.developer.address 18 | 19 | const privateKey = prsUtils.recoverPrivateKey(keystore, passwrd) 20 | 21 | const prs = new PRS({ 22 | env: 'env', debug: true, privateKey, address 23 | }) 24 | 25 | const user = await prs.user.getByAddress(address).then(res => res.body) 26 | console.log(user) 27 | 28 | const newProfile = { 29 | title: `test title ${Date.now().toString()}` 30 | } 31 | const editRes = await prs.user.editProfile(newProfile).then(res => res.body) 32 | console.log(editRes) 33 | 34 | const uploadAvater = await prs.user.uploadAvatar(avatarStr).then(res => res.body) 35 | console.log(uploadAvater) 36 | } 37 | 38 | userExample().catch(console.error) 39 | -------------------------------------------------------------------------------- /samples/util.example.js: -------------------------------------------------------------------------------- 1 | // 以下代码演示了 util 的用法 2 | // 包括 3 | // - 本地签名(文件、文本、对象、密码、http 请求) 4 | 5 | const PRS = require('prs-lib') 6 | const prsUtils = require('prs-utility') 7 | const { Readable } = require('stream') 8 | const testConfig = require('../fixtures') 9 | 10 | async function utilExample () { 11 | { 12 | // dapp 通过被用户授权的 token 进行签名 13 | const token = await getToken() 14 | // data 可以为任意结构化数据 15 | const data = { foo: 'bar' } 16 | const dataSig = await PRS.util.signByToken(data, token, new PRS({ env: 'env', debug: true }).config.getHost()).then(res => res.body) 17 | console.log(dataSig) 18 | } 19 | 20 | { 21 | // 对 Readable Stream 进行 hash 运算 22 | const rStream = new Readable() 23 | const now = Date.now().toString() 24 | rStream.push(Buffer.from(now)) 25 | rStream.push(null) 26 | const rStreamHash = await PRS.util.hashByReadableStream(rStream) 27 | console.log(rStreamHash) 28 | } 29 | 30 | { 31 | // 计算 email 和 password 的 hash 32 | const passHash = PRS.util.hashByPassword(testConfig.developer.email, testConfig.developer.password) 33 | console.log(passHash) 34 | } 35 | 36 | { 37 | // 计算 http 请求的 hash 38 | const reqHash = PRS.util.hashRequest('/test', {}) 39 | console.log(reqHash) 40 | } 41 | 42 | { 43 | // 对 http 请求相关部分进行签名 44 | const privateKey = prsUtils.recoverPrivateKey(testConfig.developer.keystore, testConfig.developer.password) 45 | const reqSig = PRS.util.signRequest('/test', {}, privateKey) 46 | console.log(reqSig) 47 | } 48 | 49 | { 50 | // 得到 http 请求的 header 部分 51 | const privateKey = prsUtils.recoverPrivateKey(testConfig.developer.keystore, testConfig.developer.password) 52 | const authHeader = PRS.util.getAuthHeader('/test', {}, privateKey) 53 | console.log(authHeader) 54 | } 55 | 56 | async function getToken () { 57 | const keystore = testConfig.developer.keystore 58 | const passwrd = testConfig.developer.password 59 | const address = testConfig.developer.address 60 | 61 | const privateKey = prsUtils.recoverPrivateKey(keystore, passwrd) 62 | 63 | const prs = new PRS({ 64 | env: 'env', debug: true, privateKey, address 65 | }) 66 | 67 | const dapp = { 68 | description: 'This is a testing app.', 69 | url: 'https://yourapp.com', 70 | redirectUrl: 'https://yourapp.com/auth' 71 | } 72 | const name = 'test dapp' + Date.now() 73 | const nameAvailable = await prs.dapp.isNameExist(name) 74 | .then(res => res.body) 75 | .then(data => data.isExist === false) 76 | if (nameAvailable) { 77 | const createRes = await prs.dapp.create({ ...dapp, name }) 78 | .then(res => res.body) 79 | 80 | const dappRes = await prs.dapp.getByAddress(createRes.address).then(res => res.body) 81 | 82 | const webAuthRes = await prs.dapp.webAuthorize(createRes.address).then(res => res.body) 83 | 84 | const dappClient = new PRS({ 85 | env: 'env', debug: true, privateKey: dappRes.privateKey, address: createRes.address 86 | }) 87 | const authRes = await dappClient.dapp.authByCode(webAuthRes.code, createRes.address, dappClient.config.privateKey).then(res => res.body) 88 | return authRes.token 89 | } 90 | } 91 | } 92 | 93 | utilExample().catch(console.error) 94 | --------------------------------------------------------------------------------