diff --git a/src/routes.js b/src/routes.js index fde63091..5b783321 100644 --- a/src/routes.js +++ b/src/routes.js @@ -1920,8 +1920,13 @@ module.exports = async ( * @type {RequestHandler<{}>} */ const apiGunMePut = async (req, res) => { + /** + * @typedef {Omit} UserWithoutPK + * @typedef {{ handshakeAddress: boolean }} HasHandshakeAddress + * @typedef {UserWithoutPK & HasHandshakeAddress} MePutBody + */ try { - const { avatar, bio , displayName} = /** @type {Partial>} */ (req.body) + const { avatar, bio , displayName, handshakeAddress } = /** @type {Partial} */ (req.body) if (avatar) { await GunActions.setAvatar(avatar, require('../services/gunDB/Mediator').getUser()) @@ -1935,6 +1940,10 @@ module.exports = async ( await GunActions.setDisplayName(displayName, require('../services/gunDB/Mediator').getUser()) } + if (handshakeAddress) { + await GunActions.generateHandshakeAddress(); + } + return res.status(200).json({ ok: true })