Skip to content

Commit

Permalink
Changes for easy demo rf5
Browse files Browse the repository at this point in the history
  • Loading branch information
mmahdigh committed Dec 2, 2024
1 parent c5402c2 commit e641a78
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/src/ai-summary-rf5
/src/rf6-pw-ranking
/src/rf6-data-import
/git-ignored-archive


# Envs
Expand Down
17 changes: 7 additions & 10 deletions src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,14 @@ export class AuthController {

@ApiResponse({ status: 200, description: 'Sets an auth cookie' })
@Post('/login')
async login(
@Res() res: Response,
@Body() { message, signature, address }: LoginDTO,
) {
async login(@Res() res: Response, @Body() { address }: LoginDTO) {
let isNewUser = false;
const isAuthentic = await this.authService.verifyUser(
message,
signature as `0x${string}`,
address as `0x${string}`,
);
if (!isAuthentic) throw new UnauthorizedException('Invalid signature');
// const isAuthentic = await this.authService.verifyUser(
// message,
// signature as `0x${string}`,
// address as `0x${string}`,
// );
// if (!isAuthentic) throw new UnauthorizedException('Invalid signature');

let user = await this.prismaService.user.findFirst({
where: { address },
Expand Down
11 changes: 6 additions & 5 deletions src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,12 @@ export class AuthService {
) => {
try {
// await this.isNonceValid(message.nonce);
const valid = await verifyMessage({
address,
message,
signature,
});
// const valid = await verifyMessage({
// address,
// message,
// signature,
// });
const valid = true;
return valid;
} catch (err) {
return false;
Expand Down
8 changes: 4 additions & 4 deletions src/auth/dto/login.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ export class SiweMessageClass {
}

export class LoginDTO {
@ApiProperty()
message: string;
// @ApiProperty()
// message: string;

@ApiProperty()
signature: string;
// @ApiProperty()
// signature: string;

@ApiProperty()
address: string;
Expand Down
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@
"incremental": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": false
}
},
"include": [
"src/**/*"
]
}

0 comments on commit e641a78

Please sign in to comment.