feat: 天河链升级为存证+发行(NFT)双层,新增轮换 UserKey 与 C 端 tokenId 展示
- 上链流程:upload 存证 → publish 铸 NFT → 接口9确认 mint → ONCHAIN,记录 tokenId/合约地址 - blockchain_proof 加 token_id/contract_address 字段(迁移),schema 补 VarChar 注解消除 drift - TianheProvider 新增 publish/updateUserKey;合约地址与 maxTokenId 存系统设置维护 baseTokenId - 轮换 UserKey:接口7 + 设置页「轮换密钥」(二次确认+回显强提示+操作日志) - C 端区块链卡展示数字藏品编号(tokenId)与合约地址 - 测试环境全链路实测通过;媒体上链层级待甲方确认,暂维持 JSON 存证 - docs/天河链文档.md 标注以 APIFox 为准并列勘误
This commit is contained in:
@@ -139,6 +139,7 @@ export const settingsApi = {
|
||||
post<{ userId: string; address: string }>('/settings/tianhe/verify', data),
|
||||
tianheIdentity: () => get<{ userId: string; address: string; userKeyMasked: string }>('/settings/tianhe/identity'),
|
||||
tianheReveal: () => post<{ userId: string; userKey: string; address: string }>('/settings/tianhe/identity/reveal', {}),
|
||||
tianheRotate: () => post<{ userId: string; userKey: string; address: string }>('/settings/tianhe/identity/rotate', {}),
|
||||
};
|
||||
|
||||
export const storageApi = {
|
||||
|
||||
@@ -552,6 +552,10 @@
|
||||
"tianheRegister": "Register Identity",
|
||||
"tianheReRegister": "Re-verify Identity",
|
||||
"tianheManualEntry": "Manual Entry",
|
||||
"tianheRotate": "Rotate Key",
|
||||
"tianheRotateConfirmTitle": "Rotate User Key",
|
||||
"tianheRotateConfirmContent": "A new User Key will be generated for the platform custodial wallet and updated on-chain; the old Key becomes invalid immediately. Be sure to save the new Key offline afterwards. Continue?",
|
||||
"tianheRotateDone": "User Key rotated",
|
||||
"tianheReveal": "Reveal",
|
||||
"tianheHide": "Hide",
|
||||
"tianheRevealConfirmTitle": "Reveal User Key",
|
||||
|
||||
@@ -552,6 +552,10 @@
|
||||
"tianheRegister": "注册链上身份",
|
||||
"tianheReRegister": "重新确认身份",
|
||||
"tianheManualEntry": "手动录入",
|
||||
"tianheRotate": "轮换密钥",
|
||||
"tianheRotateConfirmTitle": "轮换 User Key",
|
||||
"tianheRotateConfirmContent": "将为平台托管钱包生成新的 User Key 并在链上修改,旧 Key 立即失效。操作后请务必离线保存新 Key。确认继续?",
|
||||
"tianheRotateDone": "User Key 已轮换",
|
||||
"tianheReveal": "揭示",
|
||||
"tianheHide": "隐藏",
|
||||
"tianheRevealConfirmTitle": "揭示 User Key",
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
{{ identity.address ? t('pages.settings.tianheReRegister') : t('pages.settings.tianheRegister') }}
|
||||
</n-button>
|
||||
<n-button size="small" @click="manualEntryVisible = true">{{ t('pages.settings.tianheManualEntry') }}</n-button>
|
||||
<n-button v-if="identity.userKeyMasked" size="small" :loading="rotatingIdentity" @click="rotateUserKey">{{ t('pages.settings.tianheRotate') }}</n-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
@@ -257,6 +258,7 @@ const migratingStorage = ref(false);
|
||||
const confirmingStorage = ref(false);
|
||||
const registeringIdentity = ref(false);
|
||||
const verifyingIdentity = ref(false);
|
||||
const rotatingIdentity = ref(false);
|
||||
const revealKey = ref(false);
|
||||
const manualEntryVisible = ref(false);
|
||||
const identity = reactive({ userId: '', userKey: '', userKeyMasked: '', address: '' });
|
||||
@@ -417,6 +419,34 @@ async function registerIdentity() {
|
||||
}
|
||||
}
|
||||
|
||||
// 轮换 User Key:二次确认 → 链上修改 → 回显新 key 强提示离线保存
|
||||
function rotateUserKey() {
|
||||
dialog.warning({
|
||||
title: t('pages.settings.tianheRotateConfirmTitle'),
|
||||
content: t('pages.settings.tianheRotateConfirmContent'),
|
||||
positiveText: t('common.action.confirm'),
|
||||
negativeText: t('common.action.cancel'),
|
||||
onPositiveClick: async () => {
|
||||
rotatingIdentity.value = true;
|
||||
try {
|
||||
const res = await settingsApi.tianheRotate();
|
||||
identity.userId = res.userId;
|
||||
identity.userKey = res.userKey;
|
||||
identity.userKeyMasked = res.userKey ? `${res.userKey.slice(0, 3)}******${res.userKey.slice(-3)}` : '';
|
||||
identity.address = res.address;
|
||||
revealKey.value = true;
|
||||
dialog.warning({
|
||||
title: t('pages.settings.tianheRotateDone'),
|
||||
content: t('pages.settings.tianheSaveKeyWarning', { userId: res.userId, userKey: res.userKey }),
|
||||
positiveText: t('common.action.confirm'),
|
||||
});
|
||||
} finally {
|
||||
rotatingIdentity.value = false;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function verifyIdentity() {
|
||||
verifyingIdentity.value = true;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user