-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
231 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<template> | ||
<el-text class="mx-1" style="margin: 5px;">Identity Name</el-text> | ||
<el-input | ||
v-model="identity_name" | ||
clearable | ||
/> | ||
<!-- TODO: I need a fake identity-name for placeholder --> | ||
<div style="margin: 20px;" /> | ||
<el-button type="primary" @click="query">查询</el-button> | ||
<template v-if="history.length > 0"> | ||
<div style="margin: 20px;" /> | ||
<el-table :data="history" style="width: 100%"> | ||
<el-table-column prop="user_id" label="User ID"/> | ||
<el-table-column prop="pgp_message" label="PGP Message"/> | ||
</el-table> | ||
</template> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { getPGPMessageSchema } from '~/api/shamir/decrypt'; | ||
import { callApi } from '~/util/callApi'; | ||
const layoutStore = useLayoutStore(); | ||
layoutStore.title = "我的解密历史" | ||
layoutStore.path = [ | ||
{ name: "Home", path: "/" }, | ||
{ name: "Decrypt" }, | ||
{ name: "History" } | ||
] | ||
const identity_name = ref('') | ||
const history = ref([]) | ||
async function query() { | ||
const { type, data } = await callApi(getPGPMessageSchema, { | ||
identity_name: identity_name.value | ||
}) | ||
if (type !== 'success') { | ||
ElNotification({ | ||
title: '查询失败', | ||
message: data.message, | ||
position: 'bottom-right', | ||
type: 'error' | ||
}) | ||
} else { | ||
ElNotification({ | ||
title: '查询成功', | ||
position: 'bottom-right', | ||
type: 'success' | ||
}) | ||
history.value = data | ||
} | ||
} | ||
</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,92 @@ | ||
<template> | ||
<el-text class="mx-1" style="margin: 5px;">User ID</el-text> | ||
<el-input | ||
v-model="user_id" | ||
clearable | ||
/> | ||
<div style="margin: 20px;" /> | ||
<el-button type="primary" @click="query">查询</el-button> | ||
<div style="margin: 20px;" /> | ||
|
||
<template v-if="visibility"> | ||
<el-text class="mx-1" style="margin: 5px;">解密状态:{{ status ? '已' : '未' }}解密</el-text> | ||
<div style="margin: 10px;" /> | ||
|
||
<el-text class="mx-1" style="margin: 5px;">参与解密者</el-text> | ||
<div style="margin: 10px;" /> | ||
|
||
<ul> | ||
<li v-for="identity_name in identity_names" :key="identity_name">{{ identity_name }}</li> | ||
</ul> | ||
|
||
<div style="margin: 10px;" /> | ||
|
||
<el-text class="mx-1" style="margin: 5px;" v-if="status">解密后的邮箱:{{ email }}</el-text> | ||
</template> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { getDecryptStatusSchema, getDecryptedEmailSchema } from '~/api/shamir/decrypt'; | ||
import { callApi } from '~/util/callApi'; | ||
const layoutStore = useLayoutStore(); | ||
layoutStore.title = "查询解密状态" | ||
layoutStore.path = [ | ||
{ name: "Home", path: "/" }, | ||
{ name: "Decrypt" }, | ||
{ name: "Status" } | ||
] | ||
const user_id = ref('') | ||
const visibility = ref(false) | ||
const status = ref(false) | ||
const identity_names = ref([]) | ||
const email = ref('') | ||
async function query() { | ||
const { type, data } = await callApi(getDecryptStatusSchema, {}, { | ||
user_id: user_id.value | ||
}) | ||
if (type !== 'success') { | ||
ElNotification({ | ||
title: '查询失败', | ||
message: data.message, | ||
position: 'bottom-right', | ||
type: 'error' | ||
}) | ||
return | ||
} | ||
status.value = data.shamir_upload_ready | ||
identity_names.value = data.uploaded_shares_identity_names | ||
if (status.value) { | ||
const { type, data } = await callApi(getDecryptedEmailSchema, {}, { | ||
user_id: user_id.value | ||
}) | ||
if (type !== 'success') { | ||
ElNotification({ | ||
title: '查询失败', | ||
message: data.message, | ||
position: 'bottom-right', | ||
type: 'error' | ||
}) | ||
return | ||
} | ||
email.value = data.user_email | ||
} | ||
ElNotification({ | ||
title: '查询成功', | ||
position: 'bottom-right', | ||
type: 'success' | ||
}) | ||
visibility.value = true | ||
} | ||
</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,78 @@ | ||
<template> | ||
<el-text class="mx-1" style="margin: 5px;">User ID</el-text> | ||
<el-input | ||
v-model="user_id" | ||
clearable | ||
/> | ||
<div style="margin: 10px;" /> | ||
<el-text class="mx-1" style="margin: 5px;">Identity Name</el-text> | ||
<el-input | ||
v-model="identity_name" | ||
clearable | ||
/> | ||
<div style="margin: 10px;" /> | ||
<el-text class="mx-1" style="margin: 5px;">Share</el-text> | ||
<el-input | ||
v-model="share" | ||
:rows="3" | ||
type="textarea" | ||
clearable | ||
/> | ||
<div style="margin: 20px;" /> | ||
<el-button type="primary" @click="upload">上传</el-button> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { decryptSchema } from '~/api/shamir/decrypt'; | ||
import { callApi } from '~/util/callApi'; | ||
const layoutStore = useLayoutStore(); | ||
layoutStore.title = "上传解密后数据" | ||
layoutStore.path = [ | ||
{ name: "Home", path: "/" }, | ||
{ name: "Decrypt" }, | ||
{ name: "Upload" } | ||
] | ||
const identity_name = ref('') | ||
const share = ref('') | ||
const user_id = ref('') | ||
async function upload() { | ||
const userid = parseInt(user_id.value) | ||
if (isNaN(userid)) { | ||
ElNotification({ | ||
title: '上传失败', | ||
message: 'User ID 必须为数字', | ||
position: 'bottom-right', | ||
type: 'error' | ||
}) | ||
return | ||
} | ||
const { type, data } = await callApi(decryptSchema, { | ||
identity_name: identity_name.value, | ||
share: share.value, | ||
user_id: userid | ||
}) | ||
console.log(type, data) | ||
if (type === 'success') { | ||
ElNotification({ | ||
title: '上传成功', | ||
message: data.message, | ||
position: 'bottom-right', | ||
type: 'success' | ||
}) | ||
} else { | ||
ElNotification({ | ||
title: '上传失败', | ||
message: data.message, | ||
position: 'bottom-right', | ||
type: 'error' | ||
}) | ||
} | ||
} | ||
</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
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