-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #133 from dwelman/upload-credential
Allows for the upload of a credential directly into a wallet
- Loading branch information
Showing
6 changed files
with
118 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<template> | ||
<modal-window :cancelRoute="{name: 'admin.identityDetails', params: {subjectID: this.$route.params.subjectID}}" :confirmFn="confirm" confirmText="Upload Credential" | ||
title="Upload a Credential JSON" type="add"> | ||
|
||
<p class="mb-3 text-sm"> | ||
Here you can add a credential issued by another party to be stored in your wallet. Paste the JSON object below. | ||
</p> | ||
|
||
<ErrorMessage v-if="apiError" :message="apiError" title="Could not upload credential"/> | ||
|
||
<div class="mt-4"> | ||
<upload-credential-form mode="new" :value="credential" @input="(credentialPaste)=> {credential = credentialPaste}"/> | ||
</div> | ||
</modal-window> | ||
</template> | ||
|
||
<script> | ||
import ModalWindow from '../../components/ModalWindow.vue' | ||
import UploadCredentialForm from "./UploadCredentialForm.vue"; | ||
import ErrorMessage from "../../components/ErrorMessage.vue"; | ||
export default { | ||
components: { | ||
ErrorMessage, | ||
ModalWindow, | ||
UploadCredentialForm | ||
}, | ||
created() { | ||
this.subjectID = this.$route.params.subjectID; | ||
}, | ||
data () { | ||
return { | ||
apiError: '', | ||
subjectID: '', | ||
credential: {} | ||
} | ||
}, | ||
methods: { | ||
confirm () { | ||
this.$api.post(`api/proxy/internal/vcr/v2/holder/${this.subjectID}/vc`, this.credential) | ||
.then(() => { | ||
this.$emit('uploadCredential', 'Verifiable Credential issued, and loaded into wallet') | ||
this.$router.push({name: 'admin.identityDetails', params: {subjectID: this.subjectID}}) | ||
}) | ||
.catch(reason => { | ||
this.apiError = reason | ||
}) | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<template> | ||
<form class="space-y-3"> | ||
<div> | ||
<div v-if="error" class="text-red-500">{{ error }}</div> | ||
<textarea v-model="localValue" rows="10" cols="30"></textarea> | ||
</div> | ||
</form> | ||
</template> | ||
<script> | ||
export default { | ||
props: { | ||
value: Object, | ||
mode: String | ||
}, | ||
data () { | ||
return { | ||
localValue: JSON.stringify(this.value, null, 2) | ||
} | ||
}, | ||
emits: ['input'], | ||
watch: { | ||
localValue (newValue) { | ||
try { | ||
this.error = ''; | ||
let parsedInput = JSON.parse(newValue) | ||
this.$emit('input', parsedInput); | ||
} catch (e) { | ||
this.error = 'Invalid JSON format'; | ||
} | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters