diff --git a/bin/server.js b/bin/server.js index 5bfca3d..ec71470 100644 --- a/bin/server.js +++ b/bin/server.js @@ -105,7 +105,7 @@ class Server { // the app. setTimeout(function () { process.exit(0) - }, 60000 * 60 * 4) + }, 60000 * 60 * 2) // 2 hours return app } catch (err) { diff --git a/package-lock.json b/package-lock.json index 6a56185..4d4a1ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,11 +10,11 @@ "license": "MIT", "dependencies": { "@chris.troutner/ipfs": "2.0.2", - "@psf/bch-js": "^4.20.3", + "@psf/bch-js": "^4.20.13", "axios": "^0.21.1", "bcryptjs": "^2.4.3", "glob": "^7.1.6", - "ipfs-coord": "^6.6.7", + "ipfs-coord": "^6.6.8", "jsonrpc-lite": "^2.2.0", "jsonwebtoken": "^8.5.1", "jwt-bch-lib": "^1.3.0", @@ -2131,8 +2131,9 @@ "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" }, "node_modules/@psf/bch-js": { - "version": "4.20.10", - "integrity": "sha512-qDrJ3OTPwTJoRf8nryMRmd5ed9aAcnnskcv1+Tdd1Iu47n2jXhtFzI9v2Fc/FswECclmzwwjRVAfNB/LGNhsfw==", + "version": "4.20.13", + "resolved": "https://registry.npmjs.org/@psf/bch-js/-/bch-js-4.20.13.tgz", + "integrity": "sha512-BY2nFQofeynJLQm1qZNDBBLEAlCr8Sz6DwBtkD5pofM5ABX9njXFf3Ndwbhko6xcnjHl++hR88A8dPC/Bi4Q8A==", "dependencies": { "@psf/bip21": "^2.0.1", "@psf/bip32-utils": "^1.0.0", @@ -9472,9 +9473,9 @@ } }, "node_modules/ipfs-coord": { - "version": "6.6.7", - "resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-6.6.7.tgz", - "integrity": "sha512-7mclUv8xwCSDQtpAKzhwJK1LZK4fZdmomLHRvSb4iITNdeamzIepFq8gKbxQ9KVRr6bNMwMcwVlvl1Lb7lEsNg==", + "version": "6.6.8", + "resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-6.6.8.tgz", + "integrity": "sha512-nnWgdB9zXnR8FPqAHd7XKJ8zSEq//XHxZAG8rB2BJ/KU/fJINW6x7PG5bIpeLTVRvyd0XfaWmbaAfEFgly+dpQ==", "dependencies": { "bch-encrypt-lib": "^2.0.0", "orbit-db": "^0.26.1" @@ -25606,8 +25607,9 @@ "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" }, "@psf/bch-js": { - "version": "4.20.10", - "integrity": "sha512-qDrJ3OTPwTJoRf8nryMRmd5ed9aAcnnskcv1+Tdd1Iu47n2jXhtFzI9v2Fc/FswECclmzwwjRVAfNB/LGNhsfw==", + "version": "4.20.13", + "resolved": "https://registry.npmjs.org/@psf/bch-js/-/bch-js-4.20.13.tgz", + "integrity": "sha512-BY2nFQofeynJLQm1qZNDBBLEAlCr8Sz6DwBtkD5pofM5ABX9njXFf3Ndwbhko6xcnjHl++hR88A8dPC/Bi4Q8A==", "requires": { "@psf/bip21": "^2.0.1", "@psf/bip32-utils": "^1.0.0", @@ -31269,9 +31271,9 @@ } }, "ipfs-coord": { - "version": "6.6.7", - "resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-6.6.7.tgz", - "integrity": "sha512-7mclUv8xwCSDQtpAKzhwJK1LZK4fZdmomLHRvSb4iITNdeamzIepFq8gKbxQ9KVRr6bNMwMcwVlvl1Lb7lEsNg==", + "version": "6.6.8", + "resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-6.6.8.tgz", + "integrity": "sha512-nnWgdB9zXnR8FPqAHd7XKJ8zSEq//XHxZAG8rB2BJ/KU/fJINW6x7PG5bIpeLTVRvyd0XfaWmbaAfEFgly+dpQ==", "requires": { "bch-encrypt-lib": "^2.0.0", "orbit-db": "^0.26.1" diff --git a/package.json b/package.json index f28ff5e..51dfc23 100644 --- a/package.json +++ b/package.json @@ -23,12 +23,12 @@ }, "repository": "Permissionless-Software-Foundation/ipfs-bch-wallet-service", "dependencies": { - "@psf/bch-js": "^4.20.3", + "@psf/bch-js": "^4.20.13", "axios": "^0.21.1", "bcryptjs": "^2.4.3", "glob": "^7.1.6", "@chris.troutner/ipfs": "2.0.2", - "ipfs-coord": "^6.6.7", + "ipfs-coord": "^6.6.8", "jsonrpc-lite": "^2.2.0", "jsonwebtoken": "^8.5.1", "jwt-bch-lib": "^1.3.0", diff --git a/src/adapters/index.js b/src/adapters/index.js index a817902..65ece24 100644 --- a/src/adapters/index.js +++ b/src/adapters/index.js @@ -5,55 +5,55 @@ */ // Public NPM libraries -const BCHJS = require("@psf/bch-js"); +const BCHJS = require('@psf/bch-js') // Load individual adapter libraries. -const IPFSAdapter = require("./ipfs"); -const LocalDB = require("./localdb"); -const LogsAPI = require("./logapi"); -const Passport = require("./passport"); -const Nodemailer = require("./nodemailer"); +const IPFSAdapter = require('./ipfs') +const LocalDB = require('./localdb') +const LogsAPI = require('./logapi') +const Passport = require('./passport') +const Nodemailer = require('./nodemailer') // const { wlogger } = require('./wlogger') -const JSONFiles = require("./json-files"); -const FullStackJWT = require("./fullstack-jwt"); +const JSONFiles = require('./json-files') +const FullStackJWT = require('./fullstack-jwt') -const config = require("../../config"); +const config = require('../../config') class Adapters { - constructor(localConfig = {}) { + constructor (localConfig = {}) { // Encapsulate dependencies - this.ipfs = new IPFSAdapter(); - this.localdb = new LocalDB(); - this.logapi = new LogsAPI(); - this.passport = new Passport(); - this.nodemailer = new Nodemailer(); - this.jsonFiles = new JSONFiles(); - this.bchjs = new BCHJS(); - this.config = config; + this.ipfs = new IPFSAdapter() + this.localdb = new LocalDB() + this.logapi = new LogsAPI() + this.passport = new Passport() + this.nodemailer = new Nodemailer() + this.jsonFiles = new JSONFiles() + this.bchjs = new BCHJS() + this.config = config // Get a valid JWT API key and instance bch-js. - this.fullStackJwt = new FullStackJWT(config); + this.fullStackJwt = new FullStackJWT(config) } - async start() { + async start () { try { if (this.config.getJwtAtStartup) { // Get a JWT token and instantiate bch-js with it. Then pass that instance // to all the rest of the apps controllers and adapters. - await this.fullStackJwt.getJWT(); + await this.fullStackJwt.getJWT() // Instantiate bch-js with the JWT token, and overwrite the placeholder for bch-js. - this.bchjs = await this.fullStackJwt.instanceBchjs(); + this.bchjs = await this.fullStackJwt.instanceBchjs() } else { - this.bchjs = new BCHJS({ restURL: this.config.apiServer }); + this.bchjs = new BCHJS({ restURL: this.config.apiServer }) } // Start the IPFS node. - await this.ipfs.start({ bchjs: this.bchjs }); + await this.ipfs.start({ bchjs: this.bchjs }) } catch (err) { - console.error("Error in adapters/index.js/start()"); - throw err; + console.error('Error in adapters/index.js/start()') + throw err } } } -module.exports = Adapters; +module.exports = Adapters