src/components/LoginConsent/LoginConsent.js
// it. If any problems are found, an error is thrown.
it. If any problems are found, an error is thrown.
it . If any problems are found an error is thrown .
async checkRequest(req) {
    try {
      const request = new LoginConsentRequest(req)
      const verificatonCheck = await verifyRequest(request.stringable());
      if (!verificatonCheck.verified) {
        throw new Error(verificatonCheck.message)
      }
      if (request.challenge.requested_scope == null || !request.challenge.requested_scope.includes(IDENTITY_VIEW.vdxfid)) {
        throw new Error("Service is not asking permission to view your ID")
      }
      for (const scope of request.challenge.requested_scope) {
        if (!SUPPORTED_SCOPES.includes(scope)) {
          throw new Error("Service is requesting unsupported permission")
        }
      }
    } catch(e) {
      console.error(e)
      this.props.dispatch(setError(new Error(e.message)));
    }
  }
async checkRequest ( req ) { try { const request = new LoginConsentRequest ( req ) const verificatonCheck = await verifyRequest ( request . stringable ( ) ) ; if ( ! verificatonCheck . verified ) { throw new Error ( verificatonCheck . message ) } if ( request . challenge . requested_scope == null || ! request . challenge . requested_scope . includes ( IDENTITY_VIEW . vdxfid ) ) { throw new Error ( "Service is not asking permission to view your ID" ) } for ( const scope of request . challenge . requested_scope ) { if ( ! SUPPORTED_SCOPES . includes ( scope ) ) { throw new Error ( "Service is requesting unsupported permission" ) } } } catch ( e ) { console . error ( e ) this . props . dispatch ( setError ( new Error ( e . message ) ) ) ; } }
it.
it .
// Typescript sanity check // Check request signature // Ensure request has required scope (can see ID)