Skip to content

Commit

Permalink
verify expires_time
Browse files Browse the repository at this point in the history
  • Loading branch information
volodymyr-basiuk committed Nov 21, 2024
1 parent fc4914a commit 6c52a8d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ export class Verifier {
}

public verifyAuthRequest(request: AuthorizationRequestMessage) {
if (request?.expires_time && request.expires_time < Math.floor(Date.now() / 1000)) {

Check failure on line 211 in src/auth/auth.ts

View workflow job for this annotation

GitHub Actions / build (18.14.0)

Property 'expires_time' does not exist on type 'AuthorizationRequestMessage'.

Check failure on line 211 in src/auth/auth.ts

View workflow job for this annotation

GitHub Actions / build (18.14.0)

Property 'expires_time' does not exist on type 'AuthorizationRequestMessage'.
throw new Error('Message expired');
}
const groupIdValidationMap: { [k: string]: ZeroKnowledgeProofRequest[] } = {};
const requestScope = request.body.scope;
for (const proofRequest of requestScope) {
Expand Down Expand Up @@ -255,6 +258,9 @@ export class Verifier {
request: AuthorizationRequestMessage,
opts?: VerifyOpts
) {
if (response?.expires_time && response.expires_time < Math.floor(Date.now() / 1000)) {

Check failure on line 261 in src/auth/auth.ts

View workflow job for this annotation

GitHub Actions / build (18.14.0)

Property 'expires_time' does not exist on type 'AuthorizationResponseMessage'.

Check failure on line 261 in src/auth/auth.ts

View workflow job for this annotation

GitHub Actions / build (18.14.0)

Property 'expires_time' does not exist on type 'AuthorizationResponseMessage'.
throw new Error('Message expired');
}
if ((request.body.message ?? '') !== (response.body.message ?? '')) {
throw new Error('message for signing from request is not presented in response');
}
Expand Down

0 comments on commit 6c52a8d

Please sign in to comment.