Skip to content

Commit

Permalink
feat: delete devbox will delete private key
Browse files Browse the repository at this point in the history
  • Loading branch information
mlhiter committed Nov 14, 2024
1 parent e4d3879 commit f9a61ab
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { parseSSHConfig } from '../api/ssh'
import { Disposable } from '../common/dispose'
import { DevboxListItem } from '../types/devbox'
import { getDevboxDetail } from '../api/devbox'
import { defaultDevboxSSHConfigPath } from '../constant/file'
import { defaultDevboxSSHConfigPath, defaultSSHKeyPath } from '../constant/file'
import { GlobalStateManager } from '../utils/globalStateManager'
import { convertSSHConfigToVersion2 } from '../utils/sshConfig'
import { uswUrl, hzhUrl, bjaUrl, gzgUrl } from '../constant/api'
Expand Down Expand Up @@ -277,6 +277,12 @@ class ProjectTreeDataProvider
newLines.join('\n')
)

// 4. delete private key file
const privateKeyPath = `${defaultSSHKeyPath}/${deletedHost}`
fs.rmSync(privateKeyPath)

// TODO: delete known_host public key

this.refresh()
} catch (error) {
vscode.window.showErrorMessage(`Delete devbox failed: ${error.message}`)
Expand Down

0 comments on commit f9a61ab

Please sign in to comment.