Skip to content

Commit 8e901b0

Browse files
added challenge to client helper test page (#97)
1 parent 9c14d22 commit 8e901b0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

sample/client_helper/static/index.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,12 @@
9797
throw new Error("cred_uid is not available. Please start the task first.");
9898
}
9999

100+
// the verifier's challenge
101+
const challenge = document.getElementById("challengeInput").value;
102+
100103
// the disclosure UID associated with the credential
101104
const disclosure_UID = document.getElementById("disclosureUidSelect").value;
102-
const showResponse = await fetch(`${clientHelperUrl}/show?cred_uid=${cred_uid}&disc_uid=${disclosure_UID}`);
105+
const showResponse = await fetch(`${clientHelperUrl}/show?cred_uid=${cred_uid}&disc_uid=${disclosure_UID}&challenge=${challenge}`);
103106
if (!showResponse.ok) {
104107
throw new Error('Failed to fetch Show Proof');
105108
}
@@ -109,7 +112,7 @@
109112

110113
// Display the test command in the textarea
111114
const schema_uid = document.getElementById("schemaUidInput").value;
112-
const test_command = `wget --method=POST --body-data='{"schema_uid":"${schema_uid}", "issuer_url":"http://127.0.0.1:8001", "proof":"${show_proof_b64}", "disclosure_uid":"${disclosure_UID}"}' --header='Content-Type: application/json' --server-response --max-redirect=3 -d http://127.0.0.1:8004/verify -O- --no-verbose`;
115+
const test_command = `wget --method=POST --body-data='{"schema_uid":"${schema_uid}", "issuer_url":"http://127.0.0.1:8001", "proof":"${show_proof_b64}", "disclosure_uid":"${disclosure_UID}", "session_id":"${challenge}"}' --header='Content-Type: application/json' --server-response --max-redirect=3 -d http://127.0.0.1:8004/verify -O- --no-verbose`;
113116
document.getElementById('testCommand').value = test_command;
114117
console.log(test_command);
115118
} catch (error) {
@@ -162,6 +165,8 @@ <h2>ShowData (OPTIONAL)</h2>
162165
<div>
163166
<h2>Show Proof:</h2>
164167
<p>Click "Show Credential" to fetch the proof for the credential.</p>
168+
<label for="challengeInput">Verifier challenge (from the meta tag "crescent_challenge" value):</label><br>
169+
<input type="text" id="challengeInput" size="80" value=""><br>
165170
<label for="disclosureUidSelect">Disclosure UID:</label>
166171
<select id="disclosureUidSelect">
167172
<option value="crescent://email_domain">crescent://email_domain</option>

0 commit comments

Comments
 (0)