MCPcopy Create free account
hub / github.com/Thunder-Compute/thunder-cli / SavePrivateKey

Function SavePrivateKey

utils/keys.go:31–43  ·  view source on GitHub ↗

SavePrivateKey writes the private key to disk with appropriate permissions

(uuid, privateKey string)

Source from the content-addressed store, hash-verified

29
30// SavePrivateKey writes the private key to disk with appropriate permissions
31func SavePrivateKey(uuid, privateKey string) error {
32 keyDir, err := ThunderSubdir("keys")
33 if err != nil {
34 return fmt.Errorf("failed to create keys directory: %w", err)
35 }
36
37 keyFile := filepath.Join(keyDir, uuid)
38 if err := os.WriteFile(keyFile, []byte(privateKey), 0600); err != nil {
39 return fmt.Errorf("failed to write private key: %w", err)
40 }
41
42 return nil
43}

Callers 3

runSCPFunction · 0.92
runConnectWithOptionsFunction · 0.92

Calls 2

ThunderSubdirFunction · 0.85
WriteFileMethod · 0.65

Tested by 1