Skip to content

Commit b2afdd6

Browse files
committed
add dice verifier
1 parent 99a89fa commit b2afdd6

File tree

3 files changed

+62
-4
lines changed

3 files changed

+62
-4
lines changed

web-assets/js/otp.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ $(document).ready(function () {
5050
} else {
5151
$("#resend").hide();
5252
}
53+
const errorMessage = qs["message"];
54+
if (errorMessage) {
55+
$("#error").html(errorMessage);
56+
$("#error").closest(".message-wrapper").fadeIn();
57+
$("#error").closest(".messages").fadeIn();
58+
}
5359

5460
$(".close-error").on("click", function () {
5561
$(this).closest(".message-wrapper").fadeOut();
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<title>Processing verfiable credentials</title>
6+
</head>
7+
8+
<body>
9+
<noscript> You need to enable JavaScript to run this app. </noscript>
10+
11+
<script src="https://cdnjs.cloudflare.com/ajax/libs/oidc-client/1.11.5/oidc-client.min.js"
12+
integrity="sha512-pGtU1n/6GJ8fu6bjYVGIOT9Dphaw5IWPwVlqkpvVgqBxFkvdNbytUh0H8AP15NYF777P4D3XEeA/uDWFCpSQ1g=="
13+
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
14+
<script>
15+
const manager = new Oidc.UserManager({
16+
authority: 'https://tc-vcauth-uat.diceid.com',
17+
client_id: 'topcoder',
18+
response_type: 'code',
19+
scope: 'openid profile vc_authn',
20+
redirect_uri: 'https://accounts-auth0.topcoder-dev.com/dice-verify-callback.html',
21+
response_mode: 'query',
22+
loadUserInfo: false,
23+
});
24+
manager.settings.metadata = {
25+
issuer: 'https://tc-vcauth-uat.diceid.com',
26+
jwks_uri: 'https://tc-vcauth-uat.diceid.com/.well-known/openid-configuration/jwks',
27+
authorization_endpoint: 'https://tc-vcauth-uat.diceid.com/vc/connect/authorize?pres_req_conf_id=Topcoder_2FA_Validate_Cred',
28+
token_endpoint: 'https://tc-vcauth-uat.diceid.com/vc/connect/token',
29+
userinfo_endpoint: 'https://tc-vcauth-uat.diceid.com/connect/userinfo',
30+
check_session_iframe: 'https://tc-vcauth-uat.diceid.com/vc/connect/checksession',
31+
revocation_endpoint: 'https://tc-vcauth-uat.diceid.com/vc/connect/revocation',
32+
};
33+
manager.signinRedirect();
34+
</script>
35+
</body>
36+
37+
</html>

web-assets/static-pages/dice-verify-callback.html

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,29 @@
77

88
<body>
99
<noscript> You need to enable JavaScript to run this app. </noscript>
10-
11-
<h1>Verifying credentials....</h1>
12-
1310
<script src="https://cdnjs.cloudflare.com/ajax/libs/oidc-client/1.11.5/oidc-client.min.js"
1411
integrity="sha512-pGtU1n/6GJ8fu6bjYVGIOT9Dphaw5IWPwVlqkpvVgqBxFkvdNbytUh0H8AP15NYF777P4D3XEeA/uDWFCpSQ1g=="
1512
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
1613
<script>
17-
new Oidc.UserManager().signinPopupCallback()
14+
const userManager = new Oidc.UserManager({
15+
response_type: "code",
16+
response_mode: "query",
17+
loadUserInfo: false
18+
});
19+
userManager.settings.metadata = {
20+
issuer: `https://tc-vcauth-uat.diceid.com`,
21+
token_endpoint: `https://tc-vcauth-uat.diceid.com/vc/connect/token`
22+
};
23+
userManager.signinRedirectCallback().then(
24+
(user) => {
25+
console.log(user)
26+
window.parent.postMessage(user, 'https://accounts-auth0.topcoder-dev.com')
27+
},
28+
(error) => {
29+
console.log(error)
30+
window.parent.postMessage({}, 'https://accounts-auth0.topcoder-dev.com')
31+
}
32+
);
1833
</script>
1934
</body>
2035

0 commit comments

Comments
 (0)