@ebowwa/terminal 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +7 -0
- package/dist/client.d.ts +14 -0
- package/dist/config.d.ts +85 -0
- package/dist/error.d.ts +7 -0
- package/dist/exec.d.ts +46 -0
- package/dist/files.d.ts +123 -0
- package/dist/fingerprint.d.ts +66 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +5722 -6207
- package/dist/manager.d.ts +102 -0
- package/dist/mcp/index.d.ts +8 -0
- package/dist/mcp/index.js +6160 -6717
- package/dist/mcp/stdio.d.ts +8 -0
- package/dist/network-error-detector.d.ts +18 -0
- package/dist/pool.d.ts +142 -0
- package/dist/pty.d.ts +58 -0
- package/dist/resources.d.ts +62 -0
- package/dist/scp.d.ts +29 -0
- package/dist/sessions.d.ts +100 -0
- package/dist/tmux-exec.d.ts +49 -0
- package/dist/tmux-local.d.ts +272 -0
- package/dist/tmux-manager.d.ts +327 -0
- package/dist/tmux.d.ts +212 -0
- package/dist/types.d.ts +17 -0
- package/mcp/package.json +1 -1
- package/package.json +7 -7
- package/src/api.js +861 -0
- package/src/client.js +92 -0
- package/src/config.js +490 -0
- package/src/error.js +32 -0
- package/src/exec.js +183 -0
- package/src/files.js +521 -0
- package/src/fingerprint.js +336 -0
- package/src/index.js +127 -0
- package/src/manager.js +358 -0
- package/src/mcp/index.js +555 -0
- package/src/mcp/stdio.js +840 -0
- package/src/network-error-detector.js +101 -0
- package/src/pool.js +840 -0
- package/src/pty.js +344 -0
- package/src/resources.js +64 -0
- package/src/scp.js +166 -0
- package/src/sessions.js +895 -0
- package/src/tmux-exec.js +169 -0
- package/src/tmux-local.js +937 -0
- package/src/tmux-manager.js +1026 -0
- package/src/tmux.js +826 -0
- package/src/tmux.ts +1 -1
- package/src/types.js +5 -0
- package/tsconfig.json +28 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSH Key Manager - Single Source of Truth
|
|
3
|
+
*
|
|
4
|
+
* Consolidates SSH key creation, upload, and management for Hetzner.
|
|
5
|
+
* Replaces duplicate ensureSSHKey() functions in api.ts and crud.ts.
|
|
6
|
+
*
|
|
7
|
+
* FEATURES:
|
|
8
|
+
* - Create or reuse local SSH key pairs
|
|
9
|
+
* - Upload public key to Hetzner if not exists
|
|
10
|
+
* - Handle fingerprint format conversion (SHA256 <-> MD5)
|
|
11
|
+
* - Provide consistent API for all SSH key operations
|
|
12
|
+
* - OS-specific user data directory for portable key storage
|
|
13
|
+
*
|
|
14
|
+
* ENVIRONMENT VARIABLES:
|
|
15
|
+
* - HETZNER_SSH_KEYS_DIR: Override default SSH keys directory
|
|
16
|
+
*/
|
|
17
|
+
import type { HetznerClient } from "../lib/hetzner/client";
|
|
18
|
+
declare module "bun" {
|
|
19
|
+
interface Env {
|
|
20
|
+
HETZNER_SSH_KEYS_DIR?: string;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get OS-specific user data directory for SSH keys
|
|
25
|
+
* - macOS: ~/Library/Application Support/com.hetzner.codespaces/ssh-keys/
|
|
26
|
+
* - Linux: ~/.config/com.hetzner.codespaces/ssh-keys/
|
|
27
|
+
* - Windows: %APPDATA%\com.hetzner.codespaces\ssh-keys\
|
|
28
|
+
*
|
|
29
|
+
* Can be overridden via .env file:
|
|
30
|
+
* HETZNER_SSH_KEYS_DIR=/custom/path
|
|
31
|
+
*/
|
|
32
|
+
export declare function getDefaultKeysDir(): string;
|
|
33
|
+
/**
|
|
34
|
+
* SSH Key information returned by the manager
|
|
35
|
+
*/
|
|
36
|
+
export interface SSHKeyInfo {
|
|
37
|
+
keyId: number;
|
|
38
|
+
keyPath: string;
|
|
39
|
+
fingerprint: string;
|
|
40
|
+
name: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Configuration for SSH key manager
|
|
44
|
+
*/
|
|
45
|
+
export interface SSHKeyManagerConfig {
|
|
46
|
+
keyName?: string;
|
|
47
|
+
keysDir?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Fingerprint format types
|
|
51
|
+
*/
|
|
52
|
+
export type FingerprintFormat = "md5" | "sha256";
|
|
53
|
+
/**
|
|
54
|
+
* Convert SSH key fingerprint between formats
|
|
55
|
+
* Hetzner uses MD5 with colons, modern tools use SHA256
|
|
56
|
+
*/
|
|
57
|
+
export declare function convertFingerprintFormat(publicKeyPath: string, format: FingerprintFormat): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* SSH Key Manager - Main class for managing SSH keys
|
|
60
|
+
*/
|
|
61
|
+
export declare class SSHKeyManager {
|
|
62
|
+
private keyName;
|
|
63
|
+
private keysDir;
|
|
64
|
+
constructor(config?: SSHKeyManagerConfig);
|
|
65
|
+
/**
|
|
66
|
+
* Get the absolute path to the SSH keys directory
|
|
67
|
+
*/
|
|
68
|
+
private getKeysDirPath;
|
|
69
|
+
/**
|
|
70
|
+
* Get the full path to the SSH key files (absolute path)
|
|
71
|
+
*/
|
|
72
|
+
private getKeyPath;
|
|
73
|
+
/**
|
|
74
|
+
* Ensure SSH key exists locally and on Hetzner
|
|
75
|
+
* This is the main entry point - replaces duplicate ensureSSHKey() functions
|
|
76
|
+
*
|
|
77
|
+
* @param hetznerClient - Hetzner API client
|
|
78
|
+
* @returns SSH key information for server creation
|
|
79
|
+
*/
|
|
80
|
+
ensureSSHKey(hetznerClient: HetznerClient): Promise<SSHKeyInfo>;
|
|
81
|
+
/**
|
|
82
|
+
* Get local key fingerprint in SHA256 format
|
|
83
|
+
*/
|
|
84
|
+
getLocalFingerprint(): Promise<string | null>;
|
|
85
|
+
/**
|
|
86
|
+
* Get local key fingerprint in MD5 format (for Hetzner comparison)
|
|
87
|
+
*/
|
|
88
|
+
getHetznerFingerprint(): Promise<string>;
|
|
89
|
+
/**
|
|
90
|
+
* Get the key path
|
|
91
|
+
*/
|
|
92
|
+
getKeyPathValue(): string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Convenience function - creates default manager and ensures SSH key
|
|
96
|
+
* This is a drop-in replacement for the old ensureSSHKey() functions
|
|
97
|
+
*
|
|
98
|
+
* @param hetznerClient - Hetzner API client
|
|
99
|
+
* @param config - Optional configuration
|
|
100
|
+
* @returns SSH key information
|
|
101
|
+
*/
|
|
102
|
+
export declare function ensureSSHKey(hetznerClient: HetznerClient, config?: SSHKeyManagerConfig): Promise<SSHKeyInfo>;
|