[WIP] Feat: create/get user public/private key

This commit is contained in:
Levi Yan
2024-10-23 18:37:27 +08:00
parent 1e856694af
commit 4b3868ced2
3 changed files with 153 additions and 2 deletions

View File

@@ -85,6 +85,25 @@ export default class DSHome {
panel.webview.postMessage({command: 'setUsername', data: {ok: false}});
break;
}
case 'getUserPublicKey':
var userPublicKey = '';
if (this.user.existUserPrivateKey()) {
userPublicKey = this.user.getUserPublicKey();
panel.webview.postMessage({command: 'getUserPublicKey', data: {userPublicKey: userPublicKey}})
break;
} else {
panel.webview.postMessage({command: 'getUserPublicKey', data: {userPublicKey: userPublicKey}})
break;
}
case 'createUserPublicKey':
this.user.createUserSSHKey();
if (this.user.existUserPublicKey()) {
panel.webview.postMessage({command: 'createUserPublicKey', data: {ok: true}})
break;
} else {
panel.webview.postMessage({command: 'createUserPublicKey', data: {ok: false}})
break;
}
case 'getDefaultPublicKey':
var defaultPublicKey;
if (utils.existDefaultPublicKey()) {