good commit

This commit is contained in:
EthanShoeDev
2025-09-21 20:58:44 -04:00
parent 05c05f364f
commit b885beb262
6 changed files with 27 additions and 18 deletions

View File

@@ -82,9 +82,9 @@ function makeBetterSecureStore<
const unsafedRootManifest: unknown = rawRootManifestString const unsafedRootManifest: unknown = rawRootManifestString
? JSON.parse(rawRootManifestString) ? JSON.parse(rawRootManifestString)
: { : {
manifestVersion: rootManifestVersion, manifestVersion: rootManifestVersion,
manifestChunksIds: [], manifestChunksIds: [],
}; };
const rootManifest = rootManifestSchema.parse(unsafedRootManifest); const rootManifest = rootManifestSchema.parse(unsafedRootManifest);
const manifestChunks = await Promise.all( const manifestChunks = await Promise.all(
rootManifest.manifestChunksIds.map(async (manifestChunkId) => { rootManifest.manifestChunksIds.map(async (manifestChunkId) => {

View File

@@ -42,6 +42,7 @@
"build:native": "tsx scripts/native-build.ts", "build:native": "tsx scripts/native-build.ts",
"build:bob": "bob build", "build:bob": "bob build",
"lint:rust": "cd rust/uniffi-russh && just lint", "lint:rust": "cd rust/uniffi-russh && just lint",
"update-rust": "cd rust/uniffi-russh && just update-deps",
"test": "jest", "test": "jest",
"release": "release-it --only-version" "release": "release-it --only-version"
}, },

View File

@@ -6,6 +6,10 @@ default:
lint: lint:
cargo clippy --all-targets --all-features -- -D warnings cargo clippy --all-targets --all-features -- -D warnings
# Update all Cargo dependencies to the latest allowed by Cargo.toml
update-deps:
cargo update
# Run crate tests # Run crate tests
test: test:
cargo test cargo test

View File

@@ -147,13 +147,18 @@ export type SshShell = {
type RusshApi = { type RusshApi = {
uniffiInitAsync: () => Promise<void>; uniffiInitAsync: () => Promise<void>;
connect: (opts: ConnectOptions) => Promise<SshConnection>; connect: (opts: ConnectOptions) => Promise<SshConnection>;
generateKeyPair: (type: 'rsa' | 'ecdsa' | 'ed25519', generateKeyPair: (
type: 'rsa' | 'ecdsa' | 'ed25519'
// TODO: Add these // TODO: Add these
// passphrase?: string; // passphrase?: string;
// keySize?: number; // keySize?: number;
// comment?: string; // comment?: string;
) => Promise<string>; ) => Promise<string>;
validatePrivateKey: (key: string) => { valid: true; error?: never } | { valid: false; error: GeneratedRussh.SshError }; validatePrivateKey: (
key: string
) =>
| { valid: true; error?: never }
| { valid: false; error: GeneratedRussh.SshError };
}; };
// #endregion // #endregion
@@ -196,8 +201,6 @@ const streamEnumToLiteral = {
[GeneratedRussh.StreamKind.Stderr]: 'stderr', [GeneratedRussh.StreamKind.Stderr]: 'stderr',
} as const satisfies Record<GeneratedRussh.StreamKind, StreamKind>; } as const satisfies Record<GeneratedRussh.StreamKind, StreamKind>;
function generatedConnDetailsToIdeal( function generatedConnDetailsToIdeal(
details: GeneratedRussh.ConnectionDetails details: GeneratedRussh.ConnectionDetails
): ConnectionDetails { ): ConnectionDetails {
@@ -314,13 +317,13 @@ function wrapConnection(
tcpEstablishedAtMs: info.progressTimings.tcpEstablishedAtMs, tcpEstablishedAtMs: info.progressTimings.tcpEstablishedAtMs,
sshHandshakeAtMs: info.progressTimings.sshHandshakeAtMs, sshHandshakeAtMs: info.progressTimings.sshHandshakeAtMs,
}, },
startShell: async (params) => { startShell: async ({ onClosed, ...params }) => {
const shell = await conn.startShell( const shell = await conn.startShell(
{ {
term: terminalTypeLiteralToEnum[params.term], term: terminalTypeLiteralToEnum[params.term],
onClosedCallback: params.onClosed onClosedCallback: onClosed
? { ? {
onChange: (channelId) => params.onClosed!(channelId), onChange: (channelId) => onClosed(channelId),
} }
: undefined, : undefined,
terminalMode: params.terminalMode, terminalMode: params.terminalMode,
@@ -381,7 +384,11 @@ async function generateKeyPair(type: 'rsa' | 'ecdsa' | 'ed25519') {
return GeneratedRussh.generateKeyPair(map[type]); return GeneratedRussh.generateKeyPair(map[type]);
} }
function validatePrivateKey(key: string): { valid: true; error?: never } | { valid: false; error: GeneratedRussh.SshError } { function validatePrivateKey(
key: string
):
| { valid: true; error?: never }
| { valid: false; error: GeneratedRussh.SshError } {
try { try {
GeneratedRussh.validatePrivateKey(key); GeneratedRussh.validatePrivateKey(key);
return { valid: true }; return { valid: true };

View File

@@ -14,10 +14,9 @@ export type BridgeOutboundMessage =
| { type: 'resize'; cols: number; rows: number } | { type: 'resize'; cols: number; rows: number }
| { type: 'fit' } | { type: 'fit' }
| { | {
type: 'setOptions'; opts: Partial< type: 'setOptions';
Omit<ITerminalOptions, keyof ITerminalInitOnlyOptions> opts: Partial<Omit<ITerminalOptions, keyof ITerminalInitOnlyOptions>>;
> }
}
| { type: 'clear' } | { type: 'clear' }
| { type: 'focus' }; | { type: 'focus' };

View File

@@ -8,9 +8,7 @@ const logExternal: boolean = false;
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
react({ react({}),
}),
dts({ dts({
tsconfigPath: './tsconfig.app.json', tsconfigPath: './tsconfig.app.json',
// This makes dist/ look nice but breaks Cmd + Click // This makes dist/ look nice but breaks Cmd + Click