Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #7 from walt-id/feat-verifier-multitenancy
Browse files Browse the repository at this point in the history
Feat verifier multitenancy
  • Loading branch information
severinstampler authored Jan 10, 2023
2 parents 3de23eb + 02c7b6b commit 1cf0a11
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 37 deletions.
3 changes: 2 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const config = {
settings: false,
connections: false
},
home: "/Credentials"
home: "/Credentials",
tenantId: "default"
}
export{config}
8 changes: 4 additions & 4 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ export default {
},

proxy: {
'/verifier-api/': 'https://wallet.walt-test.cloud',
'/api/': 'https://wallet.walt-test.cloud'
//'/verifier-api/': 'http://localhost:8080/',
//'/api/': 'http://localhost:8080/'
//'/verifier-api/': 'https://wallet.walt-test.cloud',
//'/api/': 'https://wallet.walt-test.cloud'
'/verifier-api/': 'http://localhost:8080/',
'/api/': 'http://localhost:8080/'
},


Expand Down
66 changes: 41 additions & 25 deletions pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,45 +1,61 @@
<template>
<main class="_home d-flex justify-content-centr align-items-center">
<section class="py-5 text-center container">
<div class="row py-lg-5">
<div class="col-lg-6 col-md-8 mx-auto">
<img src="/favicon.png"/>
<h2 class="fw-normal">
Welcome to the
</h2>
<h2 class="fw-bold">
Demo Verifier Portal
</h2>
<p class="lead text-muted">
Connect your wallet and share<br>your credentials to access services.
</p>
<p>
<a :href="'/verifier-api/present/?walletId=' + wallets[0].id + '&schemaUri=' + vidSchemaUri" class="btn btn-primary my-2 fw-bold _btn">Connect Wallet using <b>Verifiable ID</b></a>
<a :href="'/verifier-api/present/?walletId=' + wallets[0].id + '&schemaUri=' + bidSchemaUri" class="btn btn-success my-2 fw-bold _btn">Connect Wallet using <b>Bank ID</b></a>
</p>
<p class="text-muted fw-bold"> {{ $config.copyright }} </p>
</div>
</div>
</section>
</main>
<div>
<header>
<Notice
text="In practice the verifier would verify the credential(s) and eventually provide access to products and services">
</Notice>
</header>
<main class="_home d-flex justify-content-centr align-items-center">
<section class="py-5 text-center container">
<div class="row py-lg-5">
<div class="col-lg-6 col-md-8 mx-auto">
<img src="/favicon.png" alt="Logo" />
<h2 class="fw-normal">
Welcome to the </h2>
<h2 class="fw-bold">
Demo Verifier Portal </h2>
<p class="lead text-muted">
Connect your wallet and share<br>your credentials to access services. </p>
<p>
<a :href="getPresentationUrl(wallets[0].id, vidSchemaUri)"
class="btn btn-primary my-2 fw-bold _btn">Connect Wallet using <b>Verifiable ID</b></a>
<a :href="'/xdevice/' + encodeURIComponent(vidSchemaUri)"
class="btn btn-primary my-2 fw-bold _btn"><i class="bi bi-upc-scan" /></a>

<a :href="getPresentationUrl(wallets[0].id, vidSchemaUri1)"
class="btn btn-primary my-2 fw-bold _btn">Connect Wallet using <b>Open Badge Credential</b></a>

<a :href="getPresentationUrl(wallets[0].id, bidSchemaUri)"
class="btn btn-success my-2 fw-bold _btn">Connect Wallet using <b>Bank ID</b></a>
</p>
<p class="text-muted fw-bold"> {{ $config.copyright }} </p>
</div>
</div>
</section>
</main>
</div>
</template>

<script>
import { config } from "../config";
export default {
data() {
return {
vidSchemaUri1: "https://ngiatlantic.info/schema/V-2022-1/OpenBadgeCredential.json",
vidSchemaUri1: "https://purl.imsglobal.org/spec/ob/v3p0/schema/json/ob_v3p0_achievementcredential_schema.json",
vidSchemaUri: 'https://api.preprod.ebsi.eu/trusted-schemas-registry/v1/schemas/0xb77f8516a965631b4f197ad54c65a9e2f9936ebfb76bae4906d33744dbcc60ba',
bidSchemaUri: 'https://raw.githubusercontent.com/walt-id/waltid-ssikit-vclib/master/src/test/resources/schemas/EuropeanBankIdentity.json'
}
},
async asyncData({ $axios }) {
const wallets = await $axios.$get('/verifier-api/wallets/list')
const wallets = await $axios.$get(`/verifier-api/${config.tenantId}/wallets/list`)
return { wallets }
},
methods: {
encodeURIComponent(str) {
return encodeURIComponent(str)
},
getPresentationUrl(walletId, schemaUri) {
return `/verifier-api/${config.tenantId}/present/?walletId=${walletId}&schemaUri=${schemaUri}`
}
}
}
Expand Down
8 changes: 3 additions & 5 deletions pages/success.vue
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@
</template>

<script>
import { config } from "../config";
if (window.opener != null) {
window.opener.location = window.location;
window.close();
Expand All @@ -315,14 +316,11 @@ export default {
let protectedData = {};
if (route.query.access_token != null) {
await $axios
.get(
"/verifier-api/auth?access_token=" +
route.query.access_token
)
.get(`/verifier-api/${config.tenantId}/auth?access_token=${route.query.access_token}`)
.then(response => {
result = response.data;
console.log(response.data);
return $axios.get("/verifier-api/protected", {
return $axios.get(`/verifier-api/${config.tenantId}/protected`, {
headers: {
Authorization: "Bearer " + result.auth_token
}
Expand Down
5 changes: 3 additions & 2 deletions pages/xdevice/_schemaUri.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@

<script>
import QRious from "qrious"
import { config } from "../../config";
export default {
async asyncData({$axios, route}) {
const requestInfo = await $axios.$get('/verifier-api/presentXDevice?schemaUri=' + route.params.schemaUri)
const requestInfo = await $axios.$get(`/verifier-api/${config.tenantId}/presentXDevice?schemaUri=${route.params.schemaUri}`)
let reqTimer = setInterval(async () => {
let response = await fetch("/verifier-api/verify/isVerified?state=" + requestInfo.requestId);
let response = await fetch(`/verifier-api/${config.tenantId}/verify/isVerified?state=${requestInfo.requestId}`);
if (response.status === 200) {
window.clearTimeout(reqTimer);
Expand Down

0 comments on commit 1cf0a11

Please sign in to comment.