Skip to content

Commit

Permalink
allow jwt in entry frontend
Browse files Browse the repository at this point in the history
Signed-off-by: F-Node-Karlsruhe <christian.fries@eecc.de>
  • Loading branch information
F-Node-Karlsruhe committed Oct 20, 2023
1 parent 861f6ed commit ee48e67
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions frontend/src/views/Entry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</div>
<!--By credential id-->
<div class="card m-3 p-3 shadow">
<h5>Credential Id</h5>
<h5>Credential Id / VC-JWT</h5>
<form v-on:submit.prevent="submitId">
<div class="input-group">
<button @click="scan = 'credid'" data-bs-toggle="modal" type="button" data-bs-target="#scan-modal"
Expand Down Expand Up @@ -107,30 +107,30 @@ export default {
onFileChange(e) {
var files = Array.from(e.target.files || e.dataTransfer.files);
files.forEach(file => {
console.log(file.type)
if (file.type != 'application/json') this.toast.warning(`Credential '${file.name}'' must be provided as a json or jwt file!`);
if (file.type != 'application/json' && file.type != 'text/plain') this.toast.warning(`Credential '${file.name}'' must be provided as a json or jwt file!`);
new Response(file).json().then(json => {
if (file.type == 'application/json') new Response(file).json().then(json => {
this.$store.dispatch("addVerifiables", Array.isArray(json) ? json : [json]);
}, () => {
new Response(file).text().then(text => {
})
else new Response(file).text().then(text => {
this.$store.dispatch("addVerifiables", [text]);
this.$store.dispatch("addVerifiables", [{ jwt: text }]);
}, () => {
this.toast.warning(`'${file.name}' is neither a json nor a jwt file!`);
})
})
})
},
submitFile() {
this.$router.push({ path: '/verify' })
},
submitId() {
this.$router.push({ path: '/verify', query: { credentialId: encodeURIComponent(this.credentialId) } })
if (this.credentialId.startsWith('http')) this.$router.push({ path: '/verify', query: { credentialId: encodeURIComponent(this.credentialId) } })
else {
this.$store.dispatch("addVerifiables", [{ jwt: this.credentialId }]);
this.$router.push({ path: '/verify' })
}
},
submitSubject() {
this.$router.push({ path: '/verify', query: { subjectId: encodeURIComponent(this.subjectId) } })
Expand Down

0 comments on commit ee48e67

Please sign in to comment.