diff --git a/config/env/common.js b/config/env/common.js index c42baaa..940d9df 100644 --- a/config/env/common.js +++ b/config/env/common.js @@ -73,5 +73,8 @@ module.exports = { // IPFS Ports ipfsTcpPort: process.env.IPFS_TCP_PORT ? process.env.IPFS_TCP_PORT : 5668, - ipfsWsPort: process.env.IPFS_WS_PORT ? process.env.IPFS_WS_PORT : 5669 + ipfsWsPort: process.env.IPFS_WS_PORT ? process.env.IPFS_WS_PORT : 5669, + + // BCH Mnemonic for generating encryption keys and payment address + mnemonic: process.env.MNEMONIC ? process.env.MNEMONIC : '' } diff --git a/package-lock.json b/package-lock.json index 5bfc181..685092c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "bcryptjs": "^2.4.3", "glob": "^7.1.6", "ipfs": "0.55.4", - "ipfs-coord": "^6.1.4", + "ipfs-coord": "^6.1.6", "jsonrpc-lite": "^2.2.0", "jsonwebtoken": "^8.5.1", "jwt-bch-lib": "^1.3.0", @@ -55,6 +55,37 @@ "uuid": "^8.3.2" } }, + "../ipfs-coord": { + "version": "6.0.0", + "extraneous": true, + "license": "MIT", + "dependencies": { + "bch-encrypt-lib": "^2.0.0", + "orbit-db": "^0.26.1" + }, + "devDependencies": { + "@psf/bch-js": "^4.20.10", + "apidoc": "^0.25.0", + "chai": "^4.2.0", + "coveralls": "^3.1.0", + "eslint": "7.17.0", + "eslint-config-prettier": "^7.1.0", + "eslint-config-standard": "^16.0.2", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-prettier": "^3.3.1", + "eslint-plugin-standard": "^4.0.0", + "husky": "^4.3.6", + "lodash.clonedeep": "^4.5.0", + "mocha": "^8.2.1", + "nyc": "^15.1.0", + "semantic-release": "^17.4.4", + "sinon": "^9.2.2", + "standard": "^16.0.3" + }, + "peerDependencies": { + "ipfs": "0.55.4" + } + }, "node_modules/@assemblyscript/loader": { "version": "0.9.4", "resolved": "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.9.4.tgz", @@ -9999,9 +10030,9 @@ } }, "node_modules/ipfs-coord": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-6.1.4.tgz", - "integrity": "sha512-uWSNJIp5JapAlLLaLczcsfZw8UO4jMu+ObA97u0otlU6eA5x2SLJj1nKnl5u1+hpRfBSiMqWGOLNifjThjdTIA==", + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-6.1.6.tgz", + "integrity": "sha512-Kpz8FW5dBNl2davNbgKycZzZx8Z5pAnUll4oRwS7+ms6cv1ydUcV5yQVItRKGxigwEzuRm9NqRLTg9eTuytP7w==", "dependencies": { "bch-encrypt-lib": "^2.0.0", "orbit-db": "^0.26.1" @@ -10531,14 +10562,22 @@ } }, "node_modules/ipfs-log/node_modules/ipld-dag-cbor/node_modules/multicodec": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-3.1.0.tgz", - "integrity": "sha512-f6d4DhbQ9a8WiJ/wpbKgeJSeR0/juP/1wnjbKdZ0KAWDkC/z7Lb3xOegMUG+uTcfwSYf6j1eTvFf8HDgqPRGmQ==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-3.1.1.tgz", + "integrity": "sha512-q29htEIgHglgxEcD0SvTmf1er68nfhm87rMKPqpClequHOTJknDCX5xA8QHBwBstgj+niO2KrsJeFzpsMZj2DQ==", "dependencies": { - "uint8arrays": "^2.1.5", + "uint8arrays": "^3.0.0", "varint": "^6.0.0" } }, + "node_modules/ipfs-log/node_modules/ipld-dag-cbor/node_modules/multicodec/node_modules/uint8arrays": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.0.0.tgz", + "integrity": "sha512-HRCx0q6O9Bfbp+HHSfQQKD7wU70+lydKVt4EghkdOvlK/NlrF90z+eXV34mUd48rNvVJXwkrMSPpCATkct8fJA==", + "dependencies": { + "multiformats": "^9.4.2" + } + }, "node_modules/ipfs-log/node_modules/ipld-dag-pb": { "version": "0.20.0", "resolved": "https://registry.npmjs.org/ipld-dag-pb/-/ipld-dag-pb-0.20.0.tgz", @@ -21024,17 +21063,24 @@ "integrity": "sha512-LPzSaBYp/TcbuSlpGwqT5jR9kvJ3Zp5ic2N5c2ybx6XB/lSfEHq2D7ja8AgoxHoMD91wXFALJoXsvshKPuXyew==" }, "node_modules/protons": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/protons/-/protons-2.0.2.tgz", - "integrity": "sha512-EIPoT9ftVirJ9QJ3oFoueYUiBhmPqE1AoSBPypLSqbbvHvx+OcUeK9z84YIsk6jda+N3FL58dU1LcWmfGCZGHA==", - "deprecated": "This module is no longer maintained", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/protons/-/protons-2.0.3.tgz", + "integrity": "sha512-j6JikP/H7gNybNinZhAHMN07Vjr1i4lVupg598l4I9gSTjJqOvKnwjzYX2PzvBTSVf2eZ2nWv4vG+mtW8L6tpA==", "dependencies": { "protocol-buffers-schema": "^3.3.1", "signed-varint": "^2.0.1", - "uint8arrays": "^2.1.3", + "uint8arrays": "^3.0.0", "varint": "^5.0.0" } }, + "node_modules/protons/node_modules/uint8arrays": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.0.0.tgz", + "integrity": "sha512-HRCx0q6O9Bfbp+HHSfQQKD7wU70+lydKVt4EghkdOvlK/NlrF90z+eXV34mUd48rNvVJXwkrMSPpCATkct8fJA==", + "dependencies": { + "multiformats": "^9.4.2" + } + }, "node_modules/protons/node_modules/varint": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", @@ -33042,9 +33088,9 @@ } }, "ipfs-coord": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-6.1.4.tgz", - "integrity": "sha512-uWSNJIp5JapAlLLaLczcsfZw8UO4jMu+ObA97u0otlU6eA5x2SLJj1nKnl5u1+hpRfBSiMqWGOLNifjThjdTIA==", + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-6.1.6.tgz", + "integrity": "sha512-Kpz8FW5dBNl2davNbgKycZzZx8Z5pAnUll4oRwS7+ms6cv1ydUcV5yQVItRKGxigwEzuRm9NqRLTg9eTuytP7w==", "requires": { "bch-encrypt-lib": "^2.0.0", "orbit-db": "^0.26.1" @@ -33531,12 +33577,22 @@ }, "dependencies": { "multicodec": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-3.1.0.tgz", - "integrity": "sha512-f6d4DhbQ9a8WiJ/wpbKgeJSeR0/juP/1wnjbKdZ0KAWDkC/z7Lb3xOegMUG+uTcfwSYf6j1eTvFf8HDgqPRGmQ==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-3.1.1.tgz", + "integrity": "sha512-q29htEIgHglgxEcD0SvTmf1er68nfhm87rMKPqpClequHOTJknDCX5xA8QHBwBstgj+niO2KrsJeFzpsMZj2DQ==", "requires": { - "uint8arrays": "^2.1.5", + "uint8arrays": "^3.0.0", "varint": "^6.0.0" + }, + "dependencies": { + "uint8arrays": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.0.0.tgz", + "integrity": "sha512-HRCx0q6O9Bfbp+HHSfQQKD7wU70+lydKVt4EghkdOvlK/NlrF90z+eXV34mUd48rNvVJXwkrMSPpCATkct8fJA==", + "requires": { + "multiformats": "^9.4.2" + } + } } } } @@ -41687,16 +41743,24 @@ "integrity": "sha512-LPzSaBYp/TcbuSlpGwqT5jR9kvJ3Zp5ic2N5c2ybx6XB/lSfEHq2D7ja8AgoxHoMD91wXFALJoXsvshKPuXyew==" }, "protons": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/protons/-/protons-2.0.2.tgz", - "integrity": "sha512-EIPoT9ftVirJ9QJ3oFoueYUiBhmPqE1AoSBPypLSqbbvHvx+OcUeK9z84YIsk6jda+N3FL58dU1LcWmfGCZGHA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/protons/-/protons-2.0.3.tgz", + "integrity": "sha512-j6JikP/H7gNybNinZhAHMN07Vjr1i4lVupg598l4I9gSTjJqOvKnwjzYX2PzvBTSVf2eZ2nWv4vG+mtW8L6tpA==", "requires": { "protocol-buffers-schema": "^3.3.1", "signed-varint": "^2.0.1", - "uint8arrays": "^2.1.3", + "uint8arrays": "^3.0.0", "varint": "^5.0.0" }, "dependencies": { + "uint8arrays": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.0.0.tgz", + "integrity": "sha512-HRCx0q6O9Bfbp+HHSfQQKD7wU70+lydKVt4EghkdOvlK/NlrF90z+eXV34mUd48rNvVJXwkrMSPpCATkct8fJA==", + "requires": { + "multiformats": "^9.4.2" + } + }, "varint": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", diff --git a/package.json b/package.json index 19a5e59..d172eea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-bch-wallet-service", - "version": "1.11.0", + "version": "1.11.1", "description": "IPFS and REST service providing blockchain access needed by a wallet. ", "main": "index.js", "scripts": { @@ -28,7 +28,7 @@ "bcryptjs": "^2.4.3", "glob": "^7.1.6", "ipfs": "0.55.4", - "ipfs-coord": "^6.1.4", + "ipfs-coord": "^6.1.6", "jsonrpc-lite": "^2.2.0", "jsonwebtoken": "^8.5.1", "jwt-bch-lib": "^1.3.0", diff --git a/src/adapters/ipfs/ipfs-coord.js b/src/adapters/ipfs/ipfs-coord.js index 242fb5b..158522b 100644 --- a/src/adapters/ipfs/ipfs-coord.js +++ b/src/adapters/ipfs/ipfs-coord.js @@ -43,6 +43,8 @@ class IpfsCoordAdapter { } async start (localConfig = {}) { + // console.log('this.config.announceJsonLd: ', this.config.announceJsonLd) + this.ipfsCoord = new this.IpfsCoord({ ipfs: this.ipfs, type: 'node.js', @@ -51,11 +53,12 @@ class IpfsCoordAdapter { privateLog: console.log, // Default to console.log isCircuitRelay: this.config.isCircuitRelay, apiInfo: this.config.apiInfo, - announceJsonLd: this.config.announceJsonLd + announceJsonLd: this.config.announceJsonLd, + mnemonic: this.config.mnemonic }) // Wait for the ipfs-coord library to signal that it is ready. - await this.ipfsCoord.start() + await this.ipfsCoord.start({ type: 'node.js' }) // Signal that this adapter is ready. this.isReady = true