web3_universal_signer 0.1.1 copy "web3_universal_signer: ^0.1.1" to clipboard
web3_universal_signer: ^0.1.1 copied to clipboard

Signer and wallet management for Web3 Universal SDK. Supports private key, mnemonic, and hardware wallet signing.

dart_web3_signer #

License: MIT

A universal signing abstraction for the Dart Web3 ecosystem. It decouples identity management from execution logic, supporting local, hardware, and remote signing workflows.

🚀 Features #

  • Unified Signer Protocol: One interface for all signing methods (EOA, MPC, HW).
  • EIP-712 Support: Domain-separated, typed data signing for human-readable approvals.
  • Hardware Integration: High-level hooks for Ledger, Trezor, and Keystone devices.
  • Message Standards: Built-in support for personal_sign and Ethereum-prefixed message hashing.

Usage Flow #

sequenceDiagram
    participant U as User
    participant C as Controller
    participant S as Signer (Keys)
    participant E as ECDSA
    U->>C: signMessage("hello")
    C->>S: request permission
    S->>S: hash(prefix + "hello")
    S->>E: sign(hash, privateKey)
    E-->>S: signature (r,s,v)
    S-->>U: hex string

🏗️ Architecture #

graph LR
    User[User Intent] --> Controller[Signer Controller]
    
    subgraph Implementations [Identity Sources]
        PK[PrivateKeySigner]
        HW[HardwareSigner]
        AA[SmartAccountSigner]
    end
    
    Controller --> Implementations
    Implementations --> Sig[EthSignature]

📚 Technical Reference #

Core Classes #

Class Responsibility
Signer The core interface for and account-bound signing.
PrivateKeySigner Local in-memory signer using raw ECDSA.
TypedData EIP-712 structure representation.
EthSignature Container for v, r, s components of a signature.

🛡️ Security Considerations #

  • Key Isolation: Keep PrivateKeySigner instances confined to the narrowest possible scope. Never share them across thread boundaries if possible.
  • Approval Verification: When using signTypedData, always display the parsed JSON in the UI for the user to verify before calling the signer.
  • Hardware Timeouts: Implement proper timeout handling when interacting with hardware signers (Level 6) to avoid app freezes.

💻 Usage #

Signing EIP-712 Typed Data #

import 'package:dart_web3_signer/dart_web3_signer.dart';

void main() async {
  final signer = PrivateKeySigner.fromHex('0x...', 1);
  
  final data = TypedData(
    domain: TypedDataDomain(name: 'MyDapp', version: '1'),
    types: {...},
    primaryType: 'Mail',
    message: {'contents': 'Hello!'},
  );

  final signature = await signer.signTypedData(data);
  print('Signature: ${signature.toHex()}');
}

📦 Installation #

dependencies:
  dart_web3_signer: ^0.1.0
0
likes
150
points
10
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Signer and wallet management for Web3 Universal SDK. Supports private key, mnemonic, and hardware wallet signing.

Homepage
Repository (GitHub)
View/report issues

Topics

#web3 #ethereum #signer #wallet

License

MIT (license)

Dependencies

web3_universal_abi, web3_universal_core, web3_universal_crypto

More

Packages that depend on web3_universal_signer