Skip to content

Commit 25334ea

Browse files
gideonairexCMCDragonkai
authored andcommitted
chore: update keys
1 parent e560978 commit 25334ea

File tree

11 files changed

+556
-341
lines changed

11 files changed

+556
-341
lines changed

package-lock.json

Lines changed: 220 additions & 110 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"dependencies": {
3131
"@matrixai/pagination": "^0.1.0",
32-
"@matrixai/polykey": "0.0.20",
32+
"@matrixai/polykey": "^0.0.22",
3333
"async-mutex": "^0.2.4",
3434
"balm-ui": "^9.0.0-rc.4",
3535
"buffer-json": "^2.0.0",

src/main/setHandlers.ts

Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ async function getAgentClient(failOnNotInitialized: boolean = true) {
1414

1515
const x = await PolykeyAgent.startAgent(polykeyPath, false, failOnNotInitialized);
1616

17-
console.log('dfgedgfr');
18-
console.log(x);
19-
2017
client = PolykeyAgent.connectToAgent(polykeyPath);
2118

2219
const res = (await promisifyGrpc(client.getStatus.bind(client))(new pb.EmptyMessage())) as pb.AgentStatusMessage;
@@ -35,7 +32,6 @@ function resolveTilde(filePath: string) {
3532
}
3633

3734
async function setHandlers() {
38-
console.log('setting handlers');
3935
///////////////////
4036
// agent control //
4137
///////////////////
@@ -49,16 +45,8 @@ async function setHandlers() {
4945
}
5046
} catch (error) {
5147
try {
52-
console.log(error);
53-
console.log('wewerwerwer');
54-
console.log(PolykeyAgent.DAEMON_SCRIPT_PATH);
55-
56-
5748
const pid = await PolykeyAgent.startAgent(polykeyPath, true);
58-
console.log('dfkjndkfjng');
59-
6049
client = PolykeyAgent.connectToAgent(polykeyPath);
61-
console.log('ggggggg');
6250
const res = (await promisifyGrpc(client.getStatus.bind(client))(new pb.EmptyMessage())) as pb.AgentStatusMessage;
6351
if (res.getStatus() != pb.AgentStatusType.ONLINE) {
6452
throw Error('agent could not be started');
@@ -289,17 +277,17 @@ async function setHandlers() {
289277
if (!client) {
290278
await getAgentClient();
291279
}
292-
const res = (await promisifyGrpc(client.listVaults.bind(client))(new pb.EmptyMessage())) as pb.StringListMessage;
280+
const res = (await promisifyGrpc(client.listVaults.bind(client))(new pb.EmptyMessage)) as pb.StringListMessage;
293281
return res.serializeBinary();
294282
});
295283

296-
// ipcMain.handle('LockNode', async (event, request) => {
297-
// if (!client) {
298-
// await getAgentClient();
299-
// }
300-
// const res = (await promisifyGrpc(client.lockNode.bind(client))(new pb.EmptyMessage)) as pb.EmptyMessage;
301-
// return
302-
// })
284+
ipcMain.handle('LockNode', async (event, request) => {
285+
if (!client) {
286+
await getAgentClient();
287+
}
288+
const res = (await promisifyGrpc(client.lockNode.bind(client))(new pb.EmptyMessage)) as pb.EmptyMessage;
289+
return
290+
})
303291

304292
ipcMain.handle('NewClientCertificate', async (event, request) => {
305293
if (!client) {
@@ -312,8 +300,6 @@ async function setHandlers() {
312300
});
313301

314302
ipcMain.handle('NewNode', async (event, request) => {
315-
console.log('heyyyyy');
316-
317303
if (!client) {
318304
await getAgentClient(false);
319305
}
@@ -376,16 +362,6 @@ async function setHandlers() {
376362
return res.serializeBinary();
377363
});
378364

379-
ipcMain.handle('RegisterNode', async (event, request) => {
380-
if (!client) {
381-
await getAgentClient();
382-
}
383-
const res = (await promisifyGrpc(client.registerNode.bind(client))(
384-
pb.StringMessage.deserializeBinary(request),
385-
)) as pb.BooleanMessage;
386-
return res.serializeBinary();
387-
});
388-
389365
ipcMain.handle('RevokeOAuthToken', async (event, request) => {
390366
if (!client) {
391367
await getAgentClient();
@@ -434,17 +410,15 @@ async function setHandlers() {
434410
return res.serializeBinary();
435411
});
436412

437-
// ipcMain.handle('UnlockNode', async (event, request) => {
438-
// if (!client) {
439-
// await getAgentClient();
440-
// }
441-
// const request = new pb.UnlockNodeMessage
442-
// request.setPassphrase(request.passphrase)
443-
// request.setTimeout(request.timeout)
444-
445-
// const res = (await promisifyGrpc(client.unlockNode.bind(client))(request)) as pb.BooleanMessage;
446-
// return res.getB()
447-
// })
413+
ipcMain.handle('UnlockNode', async (event, request) => {
414+
if (!client) {
415+
await getAgentClient();
416+
}
417+
const res = (await promisifyGrpc(client.unlockNode.bind(client))(
418+
pb.UnlockNodeMessage.deserializeBinary(request)
419+
)) as pb.BooleanMessage;
420+
return res.getB()
421+
})
448422

449423
ipcMain.handle('UpdateLocalPeerInfo', async (event, request) => {
450424
if (!client) {
@@ -485,7 +459,6 @@ async function setHandlers() {
485459
)) as pb.BooleanMessage;
486460
return res.serializeBinary();
487461
});
488-
console.log('finished setting handlers');
489462
}
490463

491464
export default setHandlers;

src/renderer/components/configuration/Configuration.vue

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,29 @@
11
<template>
2-
<v-container fluid pa-0 class="d-flex flex-column flex-grow-1 fill-parent-height">
3-
<v-row no-gutters class="top-row flex-grow-1 flex-shrink-1">
4-
<v-col class="side-panel fill-parent-height">
5-
<h2 style="text-align: center;">Configuration</h2>
6-
7-
<v-subheader>Active Key Node</v-subheader>
8-
<v-select value="~/.polykey" :items="nodePathList" label="Active Key Node" solo style="margin: 10px;" />
9-
10-
<v-subheader>Key Node List</v-subheader>
11-
<v-list-item>
12-
<v-list-item-content>
13-
<v-btn color="success" rounded small @click="newKeyNode()">New KeyNode</v-btn>
14-
</v-list-item-content>
15-
</v-list-item>
16-
17-
<v-list :item-height="50" color="transparent">
18-
<v-list-item-group v-model="selectedVaultIndex" color="primary" mandatory>
19-
<v-list-item v-for="item in nodePathList" :key="item" color="primary" link :ripple="false">
20-
<v-list-item-icon>
21-
<v-icon>fas fa-file</v-icon>
22-
</v-list-item-icon>
23-
24-
<v-list-item-title>{{ item }}</v-list-item-title>
25-
26-
<v-spacer></v-spacer>
27-
<v-btn link icon x-small color="warning" @click="deleteVault(item)">
28-
<v-icon>fas fa-trash</v-icon>
29-
</v-btn>
30-
</v-list-item>
31-
</v-list-item-group>
32-
</v-list>
33-
</v-col>
34-
</v-row>
35-
</v-container>
2+
<div>
3+
<div class="side-panel">
4+
<h2 style="text-align: center;">Configuration</h2>
5+
<ui-button raised @click="newNode()">New Node</ui-button>
6+
<ui-list :type="2" avatar>
7+
<template v-for="item in nodes">
8+
<ui-item @click="selectNode(item)">
9+
<ui-icon :class="iconClass">folder</ui-icon>
10+
<ui-item-text-content>
11+
<ui-item-text1>{{ item }}</ui-item-text1>
12+
<ui-item-text2>Node</ui-item-text2>
13+
</ui-item-text-content>
14+
<ui-item-last-content>
15+
<ui-button raised @click="deleteNode(item)">
16+
<ui-icon>delete</ui-icon>
17+
</ui-button>
18+
</ui-item-last-content>
19+
</ui-item>
20+
</template>
21+
</ui-list>
22+
</div>
23+
<div class="main-panel">
24+
25+
</div>
26+
</div>
3627
</template>
3728

3829
<script lang="ts">
Lines changed: 51 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,33 @@
11
<template>
2-
<v-container fluid pa-0 class="d-flex flex-column flex-grow-1 fill-parent-height">
3-
<v-row no-gutters class="top-row flex-grow-1 flex-shrink-1">
4-
<v-col class="side-panel fill-parent-height">
5-
<h2 style="text-align: center;">Keys</h2>
6-
<v-list :item-height="50" color="transparent">
7-
<v-subheader>Primary KeyPair</v-subheader>
8-
<v-list-item-group v-model="selectedKeyIndex" color="primary" mandatory>
9-
<v-list-item color="primary" link :ripple="false">
10-
<v-list-item-icon>
11-
<v-icon>fas fa-key</v-icon>
12-
</v-list-item-icon>
13-
14-
<v-list-item-title>Primary</v-list-item-title>
15-
16-
<v-spacer></v-spacer>
17-
<v-btn link icon x-small color="warning" disabled>
18-
<v-icon>fas fa-trash</v-icon>
19-
</v-btn>
20-
</v-list-item>
21-
<v-subheader>
22-
Keys
23-
<v-spacer></v-spacer>
24-
<v-btn color="success" rounded small @click="newKey()">New Key</v-btn>
25-
</v-subheader>
26-
<v-list-item v-for="item in keyNames" :key="item" color="primary" link :ripple="false">
27-
<v-list-item-icon>
28-
<v-icon>fas fa-key</v-icon>
29-
</v-list-item-icon>
30-
31-
<v-list-item-title>{{item}}</v-list-item-title>
32-
33-
<v-spacer></v-spacer>
34-
<v-btn link icon x-small color="warning" @click="deleteVault(item)">
35-
<v-icon>fas fa-trash</v-icon>
36-
</v-btn>
37-
</v-list-item>
38-
</v-list-item-group>
39-
</v-list>
40-
</v-col>
41-
<v-col class="main-panel fill-parent-height">
42-
<v-card>
43-
<v-banner single-line>
44-
<v-layout>
45-
<v-flex>
46-
<h3 v-if="selectedKeyIndex == 0">Key Pair - Primary</h3>
47-
<h3 v-else>Key - {{selectedKeyName}}</h3>
48-
</v-flex>
49-
</v-layout>
50-
</v-banner>
51-
<KeyPairInformation v-if="selectedKeyIndex == 0" />
52-
<KeyInformation v-else />
53-
</v-card>
54-
</v-col>
55-
</v-row>
56-
</v-container>
2+
<div class="vaults-container">
3+
<div class="side-panel">
4+
<h2 style="text-align: center;">Keys</h2>
5+
<ui-button raised @click="newKey()">New Key</ui-button>
6+
<ui-list :type="2" avatar>
7+
<template v-for="item in keyNames">
8+
<ui-item @click="selectKey(item)">
9+
<ui-icon :class="iconClass">folder</ui-icon>
10+
<ui-item-text-content>
11+
<ui-item-text1>{{ item }}</ui-item-text1>
12+
<ui-item-text2>Key</ui-item-text2>
13+
</ui-item-text-content>
14+
<ui-item-last-content>
15+
<ui-button raised @click="deleteKey(item)">
16+
<ui-icon>delete</ui-icon>
17+
</ui-button>
18+
</ui-item-last-content>
19+
</ui-item>
20+
</template>
21+
</ui-list>
22+
</div>
23+
<div class="main-panel"></div>
24+
</div>
5725
</template>
5826

5927
<script lang="ts">
60-
import { defineComponent } from 'vue'
28+
import { defineComponent, watchEffect, ref } from 'vue'
6129
import { useRouter } from 'vue-router'
30+
import useModule from '@/store/useModule'
6231
import KeyInformation from '@/components/keys/KeyInformation.vue'
6332
import KeyPairInformation from '@/components/keys/KeyPairInformation.vue'
6433
@@ -67,13 +36,30 @@ export default defineComponent({
6736
KeyInformation,
6837
KeyPairInformation
6938
},
70-
setup () {
39+
setup() {
7140
const router = useRouter()
41+
const keysStore = useModule('Keys')
42+
const keyNames = ref([])
43+
44+
watchEffect(() => {
45+
keyNames.value = keysStore.state.keyNames
46+
console.log('keys', keysStore.state.keyNames)
47+
})
48+
49+
const deleteKey = item => {
50+
keysStore.dispatch('deleteKey', item)
51+
}
52+
53+
/** Load vaults */
54+
keysStore.dispatch('loadKeyNames')
55+
7256
return {
7357
newKey: () => {
7458
router.push('/Keys/NewKey')
7559
},
76-
deleteVault: () => {}
60+
selectKey: () => {},
61+
deleteKey,
62+
keyNames
7763
}
7864
}
7965
})
@@ -147,22 +133,17 @@ export default defineComponent({
147133

148134
<style scoped>
149135
.main-panel {
150-
margin: 10px;
151-
min-height: 0;
136+
background: white;
137+
float: left;
138+
height: 100vh;
139+
width: calc(100% - 300px);
152140
}
153141
154142
.side-panel {
143+
float: left;
155144
background-color: rgb(184, 184, 184);
156145
overflow-y: scroll;
157-
max-width: 300px;
158-
min-width: 150px;
159-
}
160-
161-
.fill-parent-height {
162-
height: 100%;
163-
}
164-
165-
.top-row {
166-
min-height: 0;
146+
width: 300px;
147+
height: 100vh;
167148
}
168149
</style>

0 commit comments

Comments
 (0)