Added support for disabling encryption via .env
This commit is contained in:
parent
0afeff22b4
commit
9f131db7e3
3 changed files with 15 additions and 4 deletions
1
.env.example
Normal file
1
.env.example
Normal file
|
|
@ -0,0 +1 @@
|
|||
DISABLE_SHOCK_ENCRYPTION=false
|
||||
|
|
@ -227,7 +227,7 @@ module.exports = async (
|
|||
const deviceId = req.headers["x-shockwallet-device-id"];
|
||||
logger.debug("Decrypting route...")
|
||||
try {
|
||||
if (nonEncryptedRoutes.includes(req.path)) {
|
||||
if (nonEncryptedRoutes.includes(req.path) || process.env.DISABLE_SHOCK_ENCRYPTION) {
|
||||
return next();
|
||||
}
|
||||
|
||||
|
|
@ -1617,6 +1617,7 @@ module.exports = async (
|
|||
|
||||
const GunEvent = Common.Constants.Event
|
||||
const Key = require('../services/gunDB/contact-api/key')
|
||||
const { timeout5 } = require('../services/gunDB/contact-api/utils')
|
||||
app.get("/api/gun/lndchanbackups", async (req,res) => {
|
||||
try{
|
||||
const user = require('../services/gunDB/Mediator').getUser()
|
||||
|
|
@ -1633,8 +1634,6 @@ module.exports = async (
|
|||
})
|
||||
|
||||
const Events = require('../services/gunDB/contact-api/events')
|
||||
|
||||
const {timeout5} = require('../services/gunDB/contact-api/utils')
|
||||
|
||||
app.get(`/api/gun/${GunEvent.ON_RECEIVED_REQUESTS}`, (_, res) => {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ const server = program => {
|
|||
const Http = require('http')
|
||||
const Express = require('express')
|
||||
const Crypto = require('crypto')
|
||||
const Dotenv = require('dotenv')
|
||||
const LightningServices = require('../utils/lightningServices')
|
||||
const Encryption = require('../utils/encryptionStore')
|
||||
const app = Express()
|
||||
|
|
@ -25,6 +26,7 @@ const server = program => {
|
|||
// load app default configuration data
|
||||
const defaults = require('../config/defaults')(program.mainnet)
|
||||
// define useful global variables ======================================
|
||||
Dotenv.config()
|
||||
module.useTLS = program.usetls
|
||||
module.serverPort = program.serverport || defaults.serverPort
|
||||
module.httpsPort = module.serverPort
|
||||
|
|
@ -41,6 +43,12 @@ const server = program => {
|
|||
|
||||
logger.info('Mainnet Mode:', !!program.mainnet)
|
||||
|
||||
if (process.env.DISABLE_SHOCK_ENCRYPTION) {
|
||||
logger.error('Encryption Mode: false')
|
||||
} else {
|
||||
logger.info('Encryption Mode: true')
|
||||
}
|
||||
|
||||
const stringifyData = data => {
|
||||
if (typeof data === 'object') {
|
||||
const stringifiedData = JSON.stringify(data)
|
||||
|
|
@ -64,7 +72,10 @@ const server = program => {
|
|||
const deviceId = req.headers['x-shockwallet-device-id']
|
||||
const oldSend = res.send
|
||||
|
||||
if (!nonEncryptedRoutes.includes(req.path)) {
|
||||
if (
|
||||
!nonEncryptedRoutes.includes(req.path) &&
|
||||
!process.env.DISABLE_SHOCK_ENCRYPTION
|
||||
) {
|
||||
res.send = (...args) => {
|
||||
if (args[0] && args[0].encryptedData && args[0].encryptionKey) {
|
||||
logger.warn('Response loop detected!')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue