Skip to content

Web-SDK cleanup #214

@cpb8010

Description

@cpb8010

packages/sdk-platforms/rust/zksync-sso-erc4337/crates/zksync-sso-erc4337-ffi-web/src/lib.rs

Using unwrap() after validating array lengths on lines 1470-1481 is redundant and could panic if the try_into conversion fails for other reasons. Replace unwrap() with a proper error return since this is a public API function. Use .map_err(|_| JsValue::from_str("Failed to convert r to fixed array"))? pattern instead.

The userVerification is set to 'required' during authentication but 'discouraged' during registration (line 177 in webauthn.ts). This inconsistency may cause authentication failures on some authenticators. These values should match unless there's a specific security reason for the difference.

These hardcoded gas fee values (matching lines 1920-1921 in test) should be extracted as named constants or configurable parameters. Magic numbers like 0x77359400 make the code harder to maintain and understand. Consider defining constants like DEFAULT_MAX_PRIORITY_FEE and DEFAULT_MAX_FEE at module level.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions