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

Commit

Permalink
support multi tenancy in verifier portal
Browse files Browse the repository at this point in the history
  • Loading branch information
severinstampler committed Jan 10, 2023
1 parent e149255 commit 0e9642f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 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}
14 changes: 9 additions & 5 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
<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 + '&ui=http://foo'"
<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="'/verifier-api/present/?walletId=' + wallets[0].id + '&schemaUri=' + vidSchemaUri1 + '&ui=http://foo'"
<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="'/verifier-api/present/?walletId=' + wallets[0].id + '&schemaUri=' + bidSchemaUri"
<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">© 2022 walt.id</p>
Expand All @@ -37,21 +37,25 @@
</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 0e9642f

Please sign in to comment.