Skip to content

Commit

Permalink
add multisigSession fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosQ96 committed Oct 20, 2023
1 parent 3c4ec6c commit 32c76cd
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/routes/v1/multisigAuthenticationRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import express, { Request, Response } from 'express';
import { errorMessagesEnum } from '../../utils/errorMessages';
import { logger } from '../../utils/logger';
import { MultisigAuthenticationController } from '@/src/controllers/v1/multisigAuthenticationController';
import { findNonExpiredMultisigSessions } from '@/src/repositories/multisigSessionRepository';

export const multisigAuthenticationRouter = express.Router();
const multisigAuthenticationController = new MultisigAuthenticationController();
Expand Down Expand Up @@ -31,3 +32,26 @@ multisigAuthenticationRouter.post(
}
},
);

multisigAuthenticationRouter.get(
'/multisigAuthentication',
async (req: Request, res: Response, next) => {
try {
const { safeAddress, network } = req.body;
if (!safeAddress || !network) {
res.status(422).json({ message: errorMessagesEnum.MISSING_LOGIN_DATA });
return;
}

const multisigSession = await findNonExpiredMultisigSessions(
safeAddress,
network,
);

res.send({ active: multisigSession ? true : false });
} catch (e) {
logger.error('multisigAuthenticationController() error', e);
next(e);
}
},
);

0 comments on commit 32c76cd

Please sign in to comment.