Issue Description
The public AuthScheme export from @miden-sdk/miden-sdk is the friendly string const { Falcon: "falcon", ECDSA: "ecdsa" } (api-types.d.ts). But WebClient.newWallet(storageMode, authScheme, seed) forwards its second argument straight to wasm-bindgen, which expects the numeric wasm AuthScheme enum (AuthRpoFalcon512 = 2, AuthEcdsaK256Keccak = 1). So AuthScheme.AuthRpoFalcon512 is undefined, and the natural call client.newWallet(storageMode, AuthScheme.AuthRpoFalcon512, seed) passes undefined to wasm, which throws invalid enum value passed.
The failure mode is worse than a plain throw: the panic happens inside a future_to_promise worker closure, so the newWallet promise never settles. The call hangs forever instead of rejecting, with no way for the caller to catch it.
The React SDK's useCreateWallet() hook is affected the same way. Its DEFAULTS.AUTH_SCHEME is AuthScheme.AuthRpoFalcon512 (@miden-sdk/react dist/index.mjs, which does import { AuthScheme } from "@miden-sdk/miden-sdk" then AUTH_SCHEME: AuthScheme.AuthRpoFalcon512), so it resolves to undefined for the same reason and the default createWallet() hangs.
Reproduction Steps
import { WebClient, AccountStorageMode, AuthScheme } from "@miden-sdk/miden-sdk";
const client = await WebClient.createClient("testnet");
console.log(AuthScheme.AuthRpoFalcon512); // undefined
console.log(Object.keys(AuthScheme)); // ["Falcon", "ECDSA"]
// Hangs; console shows "invalid enum value passed", promise never settles:
await client.newWallet(AccountStorageMode.private(), AuthScheme.AuthRpoFalcon512, undefined);
Via React, the same hang:
const { createWallet } = useCreateWallet();
await createWallet(); // defaults authScheme to AuthScheme.AuthRpoFalcon512 (undefined)
Workaround: pass the numeric discriminant directly, client.newWallet(AccountStorageMode.private(), 2, undefined) (2 = AuthRpoFalcon512 in the wasm-bindgen enum).
Error Output
Error: invalid enum value passed
at wasm_bindgen::throw_str
at <miden_client_web ... newWallet ...>
at wasm_bindgen_futures::future_to_promise::{{closure}}::{{closure}}
(the newWallet promise never resolves or rejects)
Environment Information
@miden-sdk/miden-sdk: 0.15.3 (single-threaded st build)
@miden-sdk/react: 0.15.3
- Browser: Chrome
Key Question
Should newWallet (and the underlying wasm binding) accept the friendly AuthScheme string const ("falcon" / "ecdsa") and resolve it internally the way MidenClient.createWallet already does with resolveAuthScheme, or should the numeric enum be exported so AuthScheme.AuthRpoFalcon512 is defined? Whichever it is, an invalid enum value should reject the promise rather than hang the call, and useCreateWallet()'s default should map to a valid scheme so the documented hook works out of the box.
Issue Description
The public
AuthSchemeexport from@miden-sdk/miden-sdkis the friendly string const{ Falcon: "falcon", ECDSA: "ecdsa" }(api-types.d.ts). ButWebClient.newWallet(storageMode, authScheme, seed)forwards its second argument straight to wasm-bindgen, which expects the numeric wasmAuthSchemeenum (AuthRpoFalcon512 = 2,AuthEcdsaK256Keccak = 1). SoAuthScheme.AuthRpoFalcon512isundefined, and the natural callclient.newWallet(storageMode, AuthScheme.AuthRpoFalcon512, seed)passesundefinedto wasm, which throwsinvalid enum value passed.The failure mode is worse than a plain throw: the panic happens inside a
future_to_promiseworker closure, so thenewWalletpromise never settles. The call hangs forever instead of rejecting, with no way for the caller to catch it.The React SDK's
useCreateWallet()hook is affected the same way. ItsDEFAULTS.AUTH_SCHEMEisAuthScheme.AuthRpoFalcon512(@miden-sdk/reactdist/index.mjs, which doesimport { AuthScheme } from "@miden-sdk/miden-sdk"thenAUTH_SCHEME: AuthScheme.AuthRpoFalcon512), so it resolves toundefinedfor the same reason and the defaultcreateWallet()hangs.Reproduction Steps
Via React, the same hang:
Workaround: pass the numeric discriminant directly,
client.newWallet(AccountStorageMode.private(), 2, undefined)(2 =AuthRpoFalcon512in the wasm-bindgen enum).Error Output
Environment Information
@miden-sdk/miden-sdk: 0.15.3 (single-threadedstbuild)@miden-sdk/react: 0.15.3Key Question
Should
newWallet(and the underlying wasm binding) accept the friendlyAuthSchemestring const ("falcon" / "ecdsa") and resolve it internally the wayMidenClient.createWalletalready does withresolveAuthScheme, or should the numeric enum be exported soAuthScheme.AuthRpoFalcon512is defined? Whichever it is, an invalid enum value should reject the promise rather than hang the call, anduseCreateWallet()'s default should map to a valid scheme so the documented hook works out of the box.