Compare commits

...
9 Commits
4 changed files with 44 additions and 42 deletions
+1 -1
View File
@@ -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) {
+14 -12
View File
@@ -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.6",
"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.6",
"resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-6.6.6.tgz",
"integrity": "sha512-vWMrh9kjbNimXuM2fjW7weKXqm4JqvIAoLmfmfuHfRMaJkXiK1RQeTERdE7FmYYunMKVkOz045pMEAFwnNh+vA==",
"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.6",
"resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-6.6.6.tgz",
"integrity": "sha512-vWMrh9kjbNimXuM2fjW7weKXqm4JqvIAoLmfmfuHfRMaJkXiK1RQeTERdE7FmYYunMKVkOz045pMEAFwnNh+vA==",
"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"
+2 -2
View File
@@ -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.6",
"ipfs-coord": "^6.6.8",
"jsonrpc-lite": "^2.2.0",
"jsonwebtoken": "^8.5.1",
"jwt-bch-lib": "^1.3.0",
+27 -27
View File
@@ -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