Skip to content

Conversation

@arb8020
Copy link
Contributor

@arb8020 arb8020 commented Jun 27, 2025

Summary

• Add comprehensive SSH key management to bring TypeScript SDK to parity with Python SDK
• Implement sshKey() and sshKeyRotate() methods on Instance class with proper TypeScript interfaces
• Include comprehensive integration and unit tests mirroring Python SDK test suite

Key Changes

InstanceSshKey interface: Proper typing for SSH key objects with object, private_key, public_key, and password fields
Instance.sshKey(): Retrieve current SSH key details for instance
Instance.sshKeyRotate(): Generate new SSH key, invalidating the old one
Comprehensive tests: Both integration tests (mirroring Python SDK) and unit tests for type verification
Jest configuration: Proper test setup for TypeScript with 5-minute timeout for integration tests

Implementation Details

Based on Python SDK commit 58d2b66 "rotation for ssh keys", this implementation:

  • Follows established SDK patterns for async methods and error handling
  • Uses proper TypeScript interfaces for type safety
  • Includes comprehensive JSDoc documentation
  • Maintains compatibility with existing SSH connection methods

Test Coverage

• Unit tests verify method existence, API calls, and TypeScript interfaces
• Integration tests cover real-world scenarios including SSH connection validation
• Tests for uniqueness across multiple rotations and raw HTTP API endpoint access

Test plan

  • Unit tests pass (npm test test/unit/sshkey.test.ts)
  • Build succeeds (npm run build)
  • Integration tests written (requires MORPH_API_KEY environment variable to run)
  • Code follows existing patterns and conventions
  • TypeScript types export correctly

Note: Integration tests require MORPH_API_KEY environment variable but are comprehensive and mirror the Python SDK test suite exactly.

🤖 Generated with Claude Code

Add comprehensive SSH key management to bring TypeScript SDK to parity with Python SDK:

- Add InstanceSshKey interface with proper typing
- Implement sshKey() and sshKeyRotate() methods on Instance class
- Create comprehensive integration tests mirroring Python SDK test suite
- Add unit tests for method verification and type checking
- Support both sync operations following established patterns
- Include Jest configuration and test scripts

Based on Python SDK commit 58d2b66 "rotation for ssh keys"

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants