Skip to content

AuthScheme enum is unreachable from the package root, so AuthGuardedMultisigConfig cannot be constructed #365

Description

@WiktorStarczewski

AuthGuardedMultisigConfig takes the wasm AuthScheme enum, but that enum cannot be imported from the package root — a string-valued const of the same name shadows it, so every JS caller passes undefined and the constructor rejects it.

Symptom

Error: invalid enum value passed
  at miden_client_web.wasm.authguardedmultisigconfig_new
  at new AuthGuardedMultisigConfig

Repro

import { AuthScheme, AuthGuardedMultisigConfig } from '@miden-sdk/miden-sdk';
AuthScheme.AuthEcdsaK256Keccak;                                  // undefined
new AuthGuardedMultisigConfig(approvers, 1, guardian, AuthScheme.AuthEcdsaK256Keccak);  // throws

Cause

dist/*/index.js re-exports the wasm module first and api-types second, so the later definition wins:

crates/miden_client_web.js enum AuthScheme { AuthEcdsaK256Keccak = 1, AuthRpoFalcon512 = 2 }
api-types.js const AuthScheme = { Falcon: "falcon", ECDSA: "ecdsa" } ← exported

Expected

AuthGuardedMultisigConfig should take the string scheme like the rest of the friendly API — resolveAuthScheme(scheme, wasm) in js/utils.js is already the established convention for exactly this, and AuthScheme.ECDSA / AuthScheme.Falcon are what the api-types doc comment tells callers to use.

Impact

Introduced in 0.16.0-rc.7 with createAuthGuardedMultisig. Every JS consumer of guarded multisig accounts hits it. Workaround is to inline the discriminants ({ ecdsa: 1, falcon: 2 }), which is what OpenZeppelin/guardian#450 currently does.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions