Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(wallet): add recovery phrase generation and validation

Steven Enamakel0e2f2e13c2b5
diff --git a/app/src/services/walletApi.ts b/app/src/services/walletApi.ts
index 57eb580b56..07d2c33190 100644
--- a/app/src/services/walletApi.ts
+++ b/app/src/services/walletApi.ts
@@ -29,6 +29,11 @@ export interface WalletAccount {
derivationPath: string;
}
+export interface GeneratedRecoveryPhrase {
+ phrase: string;
+ wordCount: number;
+}
+
export interface WalletStatus {
configured: boolean;
onboardingCompleted: boolean;
@@ -62,6 +67,24 @@ export const fetchWalletStatus = async (): Promise<WalletStatus> => {
return response.result;
};
+/** Generate recovery material through the confidentially called TinyWallet module. */
+export const generateRecoveryPhrase = async (): Promise<GeneratedRecoveryPhrase> => {
+ const response = await callCoreRpc<{ result: GeneratedRecoveryPhrase }>({
+ method: 'openhuman.wallet_generate_mnemonic',
+ params: { wordCount: 12 },
+ });
+ return response.result;
+};
+
+/** Validate an imported phrase in the TinyWallet module without local derivation. */
+export const validateRecoveryPhrase = async (phrase: string): Promise<boolean> => {
+ const response = await callCoreRpc<{ result: { valid: boolean } }>({
+ method: 'openhuman.wallet_validate_mnemonic',
+ params: { phrase },
+ });
+ return response.result.valid;
+};
+
export const setupLocalWallet = async (params: SetupWalletParams): Promise<WalletStatus> => {
const response = await callCoreRpc<{ result: WalletStatus }>({
method: 'openhuman.wallet_setup',