const verifyToken = <T>(token: string, secret: Secret): Promise<T> => { return new Promise((resolve, reject) => { jwt.verify(token, secret, (err, decode) => { if (!err) { resolve(decode as T); } else { reject(err); } }); }); }