feat(client): add keypair generation
This commit is contained in:
@@ -9,11 +9,12 @@ import {
|
||||
} from "../../../Yonexus.Protocol/src/index.js";
|
||||
import type { YonexusClientConfig } from "./config.js";
|
||||
import {
|
||||
createInitialClientState,
|
||||
ensureClientKeyPair,
|
||||
hasClientKeyPair,
|
||||
hasClientSecret,
|
||||
type YonexusClientState,
|
||||
type YonexusClientStateStore
|
||||
createInitialClientState,
|
||||
YonexusClientState,
|
||||
YonexusClientStateStore
|
||||
} from "./state.js";
|
||||
import type { ClientConnectionState, ClientTransport } from "./transport.js";
|
||||
|
||||
@@ -66,7 +67,12 @@ export class YonexusClientRuntime {
|
||||
}
|
||||
|
||||
this.phase = "starting";
|
||||
this.clientState = await this.options.stateStore.load(this.options.config.identifier);
|
||||
|
||||
// Load existing state and ensure key pair exists
|
||||
let state = await this.options.stateStore.load(this.options.config.identifier);
|
||||
const keyResult = await ensureClientKeyPair(state, this.options.stateStore);
|
||||
this.clientState = keyResult.state;
|
||||
|
||||
await this.options.transport.connect();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user