@awcp/transport-sshfs 0.0.0-dev-202601301521 → 0.0.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.
@@ -1,93 +0,0 @@
1
- /**
2
- * SSHFS Transport Adapter
3
- *
4
- * Implements TransportAdapter interface for SSHFS transport.
5
- */
6
- import { CredentialManager } from './delegator/credential-manager.js';
7
- import { SshfsMountClient } from './executor/sshfs-client.js';
8
- export class SshfsTransport {
9
- type = 'sshfs';
10
- config;
11
- credentialManager;
12
- mountClient;
13
- constructor(config = {}) {
14
- this.config = config;
15
- }
16
- // ========== Delegator Side ==========
17
- async prepare(params) {
18
- if (!this.credentialManager) {
19
- if (!this.config.delegator?.caKeyPath) {
20
- throw new Error('SshfsTransport: delegator.caKeyPath is required for Delegator operations');
21
- }
22
- this.credentialManager = new CredentialManager({
23
- keyDir: this.config.delegator.keyDir,
24
- sshHost: this.config.delegator.host,
25
- sshPort: this.config.delegator.port,
26
- sshUser: this.config.delegator.user,
27
- caKeyPath: this.config.delegator.caKeyPath,
28
- });
29
- }
30
- const { delegationId, exportPath, ttlSeconds } = params;
31
- const { credential, endpoint } = await this.credentialManager.generateCredential(delegationId, ttlSeconds);
32
- const mountInfo = {
33
- transport: 'sshfs',
34
- endpoint,
35
- exportLocator: exportPath,
36
- credential,
37
- };
38
- return { mountInfo };
39
- }
40
- async cleanup(delegationId) {
41
- await this.credentialManager?.revokeCredential(delegationId);
42
- }
43
- // ========== Executor Side ==========
44
- async checkDependency() {
45
- this.ensureMountClient();
46
- const result = await this.mountClient.checkDependency();
47
- return {
48
- available: result.available,
49
- hint: result.available
50
- ? undefined
51
- : 'Install sshfs: brew install macfuse && brew install sshfs (macOS) or apt install sshfs (Linux)',
52
- };
53
- }
54
- async setup(params) {
55
- this.ensureMountClient();
56
- const { mountInfo, workDir } = params;
57
- if (mountInfo.transport !== 'sshfs') {
58
- throw new Error(`SshfsTransport: unexpected transport type: ${mountInfo.transport}`);
59
- }
60
- const info = mountInfo;
61
- await this.mountClient.mount({
62
- endpoint: info.endpoint,
63
- exportLocator: info.exportLocator,
64
- credential: info.credential,
65
- mountPoint: workDir,
66
- options: info.mountOptions,
67
- });
68
- return workDir;
69
- }
70
- async teardown(params) {
71
- await this.mountClient?.unmount(params.workDir);
72
- }
73
- // ========== Helpers ==========
74
- ensureMountClient() {
75
- if (!this.mountClient) {
76
- this.mountClient = new SshfsMountClient({
77
- tempKeyDir: this.config.executor?.tempKeyDir,
78
- defaultOptions: this.config.executor?.defaultMountOptions,
79
- mountTimeout: this.config.executor?.mountTimeout,
80
- });
81
- }
82
- }
83
- async unmountAll() {
84
- await this.mountClient?.unmountAll();
85
- }
86
- async revokeAllCredentials() {
87
- await this.credentialManager?.revokeAll();
88
- }
89
- async cleanupStaleKeyFiles() {
90
- return this.credentialManager?.cleanupStaleKeyFiles() ?? 0;
91
- }
92
- }
93
- //# sourceMappingURL=sshfs-transport.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sshfs-transport.js","sourceRoot":"","sources":["../src/sshfs-transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG9D,MAAM,OAAO,cAAc;IAChB,IAAI,GAAG,OAAgB,CAAC;IAEzB,MAAM,CAAuB;IAC7B,iBAAiB,CAAqB;IACtC,WAAW,CAAoB;IAEvC,YAAY,SAA+B,EAAE;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,uCAAuC;IAEvC,KAAK,CAAC,OAAO,CAAC,MAA8B;QAC1C,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,CAAC;gBACtC,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CA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C,oBAAoB;QACxB,OAAO,IAAI,CAAC,iBAAiB,EAAE,oBAAoB,EAAE,IAAI,CAAC,CAAC;IAC7D,CAAC;CACF"}
package/dist/types.d.ts DELETED
@@ -1,114 +0,0 @@
1
- /**
2
- * SSHFS Transport Configuration Types
3
- */
4
- export { SshfsMountInfo, SshCredential, SshEndpoint } from '@awcp/core';
5
- /**
6
- * Delegator-side configuration for SSHFS transport
7
- */
8
- export interface SshfsDelegatorConfig {
9
- /** Directory to store temporary keys (default: ~/.awcp/keys) */
10
- keyDir?: string;
11
- /** Path to CA private key for signing certificates */
12
- caKeyPath: string;
13
- /** SSH server host (default: localhost) */
14
- host?: string;
15
- /** SSH server port (default: 22) */
16
- port?: number;
17
- /** SSH user for connections */
18
- user?: string;
19
- }
20
- /**
21
- * Executor-side configuration for SSHFS transport
22
- */
23
- export interface SshfsExecutorConfig {
24
- /** Directory to store temporary key files (default: /tmp/awcp/client-keys) */
25
- tempKeyDir?: string;
26
- /** Additional sshfs mount options */
27
- defaultMountOptions?: Record<string, string>;
28
- /** Timeout for mount operation in milliseconds (default: 30000) */
29
- mountTimeout?: number;
30
- }
31
- /**
32
- * Combined configuration for SshfsTransport
33
- */
34
- export interface SshfsTransportConfig {
35
- /** Delegator-side configuration */
36
- delegator?: SshfsDelegatorConfig;
37
- /** Executor-side configuration */
38
- executor?: SshfsExecutorConfig;
39
- }
40
- /**
41
- * Credential Manager configuration
42
- */
43
- export interface CredentialManagerConfig {
44
- /** Directory to store temporary keys (default: ~/.awcp/keys) */
45
- keyDir?: string;
46
- /** Path to CA private key for signing certificates */
47
- caKeyPath: string;
48
- /** SSH server host (default: localhost) */
49
- sshHost?: string;
50
- /** SSH server port (default: 22) */
51
- sshPort?: number;
52
- /** SSH user for connections */
53
- sshUser?: string;
54
- }
55
- /**
56
- * Generated credential info
57
- */
58
- export interface GeneratedCredential {
59
- /** The private key content */
60
- privateKey: string;
61
- /** Path to the private key file */
62
- privateKeyPath: string;
63
- /** Path to the public key file */
64
- publicKeyPath: string;
65
- /** Path to the certificate file */
66
- certPath: string;
67
- /** Delegation ID for tracking */
68
- delegationId: string;
69
- }
70
- /**
71
- * SSHFS Mount Client configuration
72
- */
73
- export interface SshfsMountConfig {
74
- /** Directory to store temporary key files */
75
- tempKeyDir?: string;
76
- /** Additional sshfs options */
77
- defaultOptions?: Record<string, string>;
78
- /** Timeout for mount operation in ms (default: 30000) */
79
- mountTimeout?: number;
80
- }
81
- /**
82
- * Mount parameters for SSHFS
83
- */
84
- export interface MountParams {
85
- /** SSH endpoint */
86
- endpoint: {
87
- host: string;
88
- port: number;
89
- user: string;
90
- };
91
- /** Remote path or export locator */
92
- exportLocator: string;
93
- /** SSH credential (private key + certificate) */
94
- credential: {
95
- privateKey: string;
96
- certificate: string;
97
- };
98
- /** Local mount point path */
99
- mountPoint: string;
100
- /** Additional mount options */
101
- options?: Record<string, string>;
102
- }
103
- /**
104
- * Active mount tracking info
105
- */
106
- export interface ActiveMount {
107
- /** Local mount point path */
108
- mountPoint: string;
109
- /** Path to temporary private key file */
110
- keyPath: string;
111
- /** Path to temporary certificate file */
112
- certPath: string;
113
- }
114
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAElB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC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CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IAEF,oCAAoC;IACpC,aAAa,EAAE,MAAM,CAAC;IAEtB,iDAAiD;IACjD,UAAU,EAAE;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IAEF,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IAEnB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IAEnB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAEhB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;CAClB"}
package/dist/types.js DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * SSHFS Transport Configuration Types
3
- */
4
- export {};
5
- //# sourceMappingURL=types.js.map
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}