Skip to content

Commit

Permalink
loadtest in admin wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
StanislavShevchenko committed Sep 11, 2019
1 parent a16022b commit ae40afa
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/server/login/login-middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { wrapAsync, lightLogs } from '../utils/helpers'
import UserDBPrivate from '../db/mongo/user-privat-provider'
import SEA from 'gun/sea'
import Config from '../server.config.js'
import AdminWallet from "../blockchain/AdminWallet";
// const ExtractJwt = passportJWT.ExtractJwt
// const JwtStrategy = passportJWT.Strategy

Expand Down Expand Up @@ -137,7 +138,25 @@ const setup = (app: Router) => {
res.end()
})
)


/**
* Only for loadtets
*/
app.post(
'/test/add/whitelistUser',
passport.authenticate('jwt', { session: false }),
wrapAsync(async (req, res, next) => {
const { body, user } = req
const gdSignature = body.gdSignature
const nonce = body.nonce
const msg = 'Login to GoodDAPP'
const gdPublicAddress = recoverPublickey(gdSignature, msg, nonce)
await AdminWallet.whitelistUser(gdPublicAddress, body.profilePublickey)
res.json({ ok: 1})
})
)


logger.child({ from: 'login-middleware' }).info('Done setup login middleware.')
}

Expand Down

0 comments on commit ae40afa

Please sign in to comment.