Skip to content

Commit b95b4c8

Browse files
committed
d
1 parent 2a2c834 commit b95b4c8

File tree

4 files changed

+613
-1
lines changed

4 files changed

+613
-1
lines changed

src/libs/kdbx/mod.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ export function getEntryType($entry: KDBX.Inner.KeePassFile.Entry) {
1919
if ($entry.getDirectStringByKeyOrNull("SeedPhrase")?.getValueOrThrow().get())
2020
return "seed"
2121

22+
if ($entry.getDirectStringByKeyOrNull("SshPublicKey")?.getValueOrThrow().get())
23+
return "ssh"
24+
2225
return "password"
2326
}
2427

@@ -43,6 +46,9 @@ export function getEntryFilter($entry: KDBX.Inner.KeePassFile.Entry) {
4346
if (type === "seed")
4447
return "seed"
4548

49+
if (type === "ssh")
50+
return "ssh"
51+
4652
return "password"
4753
}
4854

src/mods/app/session/account/mod.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { MoneroAccountAddMenuAnchor, MoneroAccountPage, StandaloneMoneroAccountA
1515
import { PasswordAccountAddMenuAnchor, PasswordAccountAddPage, PasswordAccountPage } from "./password/mod.tsx";
1616
import { SeedAccountAddMenuAnchor, SeedAccountAddPage, SeedAccountPage } from "./seed/mod.tsx";
1717
import { SolanaAccountAddMenuAnchor, SolanaAccountPage, StandaloneSolanaAccountAddPage } from "./solana/mod.tsx";
18+
import { SshAccountAddMenuAnchor, SshAccountAddPage, SshAccountPage } from "./ssh/mod.tsx";
1819

1920
React;
2021

@@ -74,6 +75,9 @@ export function AccountCardInGrid(props: { $entry: KDBX.Inner.KeePassFile.Entry
7475
if (type === "seed")
7576
return <SeedAccountPage $entry={$entry} />
7677

78+
if (type === "ssh")
79+
return <SshAccountPage $entry={$entry} />
80+
7781
return null
7882
})()}
7983
</PathBoard>}
@@ -147,6 +151,9 @@ export function AccountCardInGrid(props: { $entry: KDBX.Inner.KeePassFile.Entry
147151
if (type === "seed")
148152
return $entry.getDirectStringByKeyOrNull("SeedPhrase")?.getValueOrThrow().get().split(" ").at(0)
149153

154+
if (type === "ssh")
155+
return $entry.getDirectStringByKeyOrNull("SshPublicKey")?.getValueOrThrow().get()?.trim().split(/\s+/).slice(0, 2).join(" ")
156+
150157
return null
151158
})()}
152159
</div>
@@ -191,6 +198,12 @@ export function AccountCardInGrid(props: { $entry: KDBX.Inner.KeePassFile.Entry
191198
Seed
192199
</div>
193200

201+
if (type === "ssh")
202+
return <div className="bg-default-contrast rounded-xl po-1 flex items-center gap-2">
203+
<Outline.KeyIcon className="size-5" />
204+
SSH
205+
</div>
206+
194207
if (type === "password")
195208
return <div className="bg-default-contrast rounded-xl po-1 flex items-center gap-2">
196209
<Outline.LanguageIcon className="size-5" />
@@ -274,6 +287,9 @@ export function AccountCard(props: { $entry: KDBX.Inner.KeePassFile.Entry }) {
274287
if (type === "seed")
275288
return $entry.getDirectStringByKeyOrNull("SeedPhrase")?.getValueOrThrow().get().split(" ").at(0)
276289

290+
if (type === "ssh")
291+
return $entry.getDirectStringByKeyOrNull("SshPublicKey")?.getValueOrThrow().get()?.trim().split(/\s+/).slice(0, 2).join(" ")
292+
277293
return null
278294
})()}
279295
</div>
@@ -318,6 +334,12 @@ export function AccountCard(props: { $entry: KDBX.Inner.KeePassFile.Entry }) {
318334
Seed
319335
</div>
320336

337+
if (type === "ssh")
338+
return <div className="bg-default-contrast rounded-xl po-1 flex items-center gap-2">
339+
<Outline.KeyIcon className="size-5" />
340+
SSH
341+
</div>
342+
321343
if (type === "password")
322344
return <div className="bg-default-contrast rounded-xl po-1 flex items-center gap-2">
323345
<Outline.LanguageIcon className="size-5" />
@@ -381,12 +403,17 @@ export function AccountAddMenu() {
381403
<PathBoard>
382404
<SeedAccountAddPage />
383405
</PathBoard>}
406+
{hash.url.pathname === "/ssh" &&
407+
<PathBoard>
408+
<SshAccountAddPage />
409+
</PathBoard>}
384410
</SubpathProvider>
385411
<div className="flex flex-col text-left gap-2">
386412
<PasswordAccountAddMenuAnchor />
387413
<CryptoAccountAddMenuAnchor />
388414
<CardAccountAddMenuAnchor />
389415
<SeedAccountAddMenuAnchor />
416+
<SshAccountAddMenuAnchor />
390417
</div>
391418
</Fragment>
392419
}

0 commit comments

Comments
 (0)