AuthScheme.AuthEcdsaK256Keccak is undefined in initializeSignerAccount, breaking external-signer account creation
- Linguagem predominante
- TypeScript
- Estrelas
- 1
- Forks
- 21
- Merge médio
- 12h 14min
- PRs com merge (30d)
- 41
Descrição
## Issue Description
Same root cause as #223, different call site.
`initializeSignerAccount()` in `packages/react-sdk/src/utils/signerAccount.ts` (used by external-signer integrations — MidenFi wallet adapter, Para, Turnkey) builds the auth component like this:
```ts
const { AccountBuilder, AccountComponent, AuthScheme, Word } =
await import("@miden-sdk/miden-sdk");
...
let builder = new AccountBuilder(seed)
.withAuthComponent(
AccountComponent.createAuthComponentFromCommitment(
commitmentWord,
AuthScheme.AuthEcdsaK256Keccak
)
)
...
```
`AuthScheme` here is the friendly string const exported from `@miden-sdk/miden-sdk` (`{ Falcon: "falcon", ECDSA: "ecdsa" }`) — it has no `AuthEcdsaK256Keccak` property, so this is always `undefined`.
`AccountComponent.createAuthComponentFromCommitment` (`crates/web-client/src/models/account_component.rs:187`) is a wasm-bindgen static method whose second parameter is the raw numeric `AuthScheme` enum (`AuthEcdsaK256Keccak = 1`), not the friendly string. Passing `undefined` should throw `invalid enum value passed` synchronously from the WASM boundary.
## Impact
This runs on the account-creation path of `initializeSignerAccount` (not the fast "import by ID" path), so any external-signer integration that creates a fresh account rather than importing an existing one hits this.
## Suggested fix
Unlike `WebClient.newWallet`/`newFaucet` (fixed in #276 by resolving through the existing internal `resolveAuthScheme()` helper before forwarding to the WASM-wrapped `WebClient` methods), `AccountComponent.createAuthComponentFromCommitment` is a raw wasm-bindgen static method with no JS-layer wrapper in `crates/web-client/js/` to hook a resolver into. Fixing this properly likely means either:
- adding a thin JS wrapper around `AccountComponent.createAuthComponentFromCommitment` (mirroring the `newWallet`/`newFaucet` pattern), or
- exporting `resolveAuthScheme` (or the raw numeric `AuthScheme` values) from the package's public surface so `packages/react-sdk` can resolve before calling the raw WASM method directly.
Given the different fix shape, this seemed better tracked as its own issue rather than folding into #276.
Guia de contribuição
Direção de pesquisa
The issue is in packages/react-sdk/src/utils/signerAccount.ts where AuthScheme.AuthEcdsaK256Keccak is undefined. Examine the @miden-sdk/miden-sdk package to see how AuthScheme is exported. Look at crates/web-client/src/models/account_component.rs to understand the WASM method signature. The fix likely involves creating a JS wrapper or exposing numeric enum values. Start by running any existing tests for external-signer account creation to reproduce the error.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- rust, typescript, wasm
- Domínio
- backend-api-design, devtools
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Pouca atividade
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 55/100