Skip to content

Commit

Permalink
[INJIVER-794] refactor qtdata
Browse files Browse the repository at this point in the history
Signed-off-by: srikanth716 <[email protected]>
  • Loading branch information
srikanth716 committed Dec 13, 2024
1 parent c609b74 commit 495d85e
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions ui/src/redux/features/verify/verifySaga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,14 @@ import {
AlertMessages,
OPENID4VP_PROTOCOL,
PollStatusDelay,
verifiableClaims,
} from "../../../utils/config";
import { v4 as uuidv4 } from "uuid";
import { raiseAlert } from "../alerts/alerts.slice";

function* fetchRequestUri(claims: string[]) {
let qrData;
let txnId;
let reqId;
const apiRequest: ApiRequest = api.fetchVpRequest;
const selectedType = claims[0];
const pdef = verifiableClaims.filter((claim) => {
return claim.type === selectedType && claim.definition;
})[0].definition;
pdef["id"] = uuidv4();
const requestOptions = {
method: apiRequest.methodType,
headers: apiRequest.headers(),
Expand All @@ -44,15 +37,22 @@ function* fetchRequestUri(claims: string[]) {
qrData =
OPENID4VP_PROTOCOL +
btoa(
`client_id=${parsedData.authorizationDetails.clientId}
&response_type=${parsedData.authorizationDetails.responseType}
&response_mode=direct_post
&nonce=${parsedData.authorizationDetails.nonce}
&state=${parsedData.requestId}
&response_uri=${window._env_.VERIFY_SERVICE_API_URL + parsedData.authorizationDetails.responseUri}
&presentation_definition_uri=${window._env_.VERIFY_SERVICE_API_URL + parsedData.authorizationDetails.presentationDefinitionUri}
&client_metadata={"name":"${window.location}"}
&presentation_definition=${JSON.stringify(pdef)}`
`client_id=${parsedData.authorizationDetails.clientId}` +
`&response_type=${parsedData.authorizationDetails.responseType}` +
`&response_mode=direct_post` +
`&nonce=${parsedData.authorizationDetails.nonce}` +
`&state=${parsedData.requestId}` +
`&response_uri=${
window.location.origin +
window._env_.VERIFY_SERVICE_API_URL +
parsedData.authorizationDetails.responseUri
}` +
`&presentation_definition_uri=${
window.location.origin +
window._env_.VERIFY_SERVICE_API_URL +
parsedData.authorizationDetails.presentationDefinitionUri
}` +
`&client_metadata={"client_name":"${window.location.origin}"}`
);
txnId = parsedData.transactionId;
reqId = parsedData.requestId;
Expand Down

0 comments on commit 495d85e

Please sign in to comment.