@@ -46,6 +46,20 @@ export function RealmCard() {
4646 setTimeout ( ( ) => setCopied ( false ) , 2000 ) ;
4747 } ;
4848
49+ const handleDownloadPublicKey = ( ) => {
50+ const blob = new Blob ( [ activeRealm . keyPair . publicKeyHex ] , {
51+ type : "text/plain" ,
52+ } ) ;
53+ const url = URL . createObjectURL ( blob ) ;
54+ const a = document . createElement ( "a" ) ;
55+ a . href = url ;
56+ a . download = `${ activeRealm . name . toLowerCase ( ) . replace ( / \s + / g, "-" ) } .pub` ;
57+ document . body . appendChild ( a ) ;
58+ a . click ( ) ;
59+ document . body . removeChild ( a ) ;
60+ URL . revokeObjectURL ( url ) ;
61+ } ;
62+
4963 const handleDelete = ( ) => {
5064 deleteRealm ( activeRealm . id ) ;
5165 setShowDeleteDialog ( false ) ;
@@ -108,10 +122,20 @@ export function RealmCard() {
108122 variant = "ghost"
109123 size = "sm"
110124 onClick = { handleCopyPublicKey }
125+ title = "Copy to clipboard"
111126 >
112127 < Copy className = "h-4 w-4" />
113128 < span className = "sr-only" > Copy</ span >
114129 </ Button >
130+ < Button
131+ variant = "ghost"
132+ size = "sm"
133+ onClick = { handleDownloadPublicKey }
134+ title = "Download public key"
135+ >
136+ < Download className = "h-4 w-4" />
137+ < span className = "sr-only" > Download</ span >
138+ </ Button >
115139 </ div >
116140 { copied && (
117141 < p className = "mt-1 text-xs text-muted-foreground" >
0 commit comments