Skip to content

Rust crypto CLI exploring wallets, key derivation, signing, and WalletConnect / Web3 integrations.

License

Notifications You must be signed in to change notification settings

0x4543/zeta-crypto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zeta Crypto CLI

License: MIT Language: Rust Status: Experimental CLI

zeta-crypto is a lightweight Rust-based command-line tool for experimenting with wallet functionality, mnemonic generation, signing, and WalletConnect sessions.


Commands Overview

Generate Mnemonic

zeta-cli gen-mnemonic

Generates a new BIP39 mnemonic phrase.

Derive Wallet

zeta-cli derive-wallet --phrase "<mnemonic>" --pass "<optional password>"

Derives a wallet address from a mnemonic phrase.

Sign Message

zeta-cli sign --phrase "<mnemonic>" --msg "hello world"

Signs a message using the wallet’s private key.

Verify Signature

zeta-cli verify --pubhex <public_key_hex> --msg "hello world" --sig <signature>

Verifies a previously signed message.

WalletConnect

zeta-cli walletconnect --peer <peer_url> --action connect

Establish or disconnect a WalletConnect session with a peer.


Utility Commands

These commands provide quick access to key Zeta Crypto file locations.

Log Path

zeta-cli log-path

Displays the full path to the log file: ~/.zeta_crypto/logs.txt.

Config Path

zeta-cli config-path

Displays the path to the configuration file: ~/.zeta_crypto/config.toml.

Session Path

zeta-cli session-path

Displays the path to the session file: ~/.zeta_crypto/session.json.


WalletConnect Status

Check if a WalletConnect peer is active and reachable.

zeta-cli walletconnect-status --peer "wc:example@2?relay-protocol=irn&symKey=..."

Output:

✅ WalletConnect peer is active and reachable

or

⚠️ Unable to reach peer or session inactive

WalletConnect Info

Display detailed information about a WalletConnect peer, including its status and last update timestamp.

zeta-cli walletconnect-info --peer "wc:example@2?relay-protocol=irn&symKey=..."

Output:

Peer: wc:example@2?relay-protocol=irn&symKey=...
Status: connected (updated at 1730573102)

This command helps monitor the current state of a WalletConnect session and can be used together with walletconnect-status to perform basic connection health checks.


WalletConnect Restore

You can restore the last saved WalletConnect session from local storage.

zeta-cli walletconnect-restore

Example output:

Restored session:
Peer: wc:example@2?relay-protocol=irn&symKey=...
Status: connected (updated at 1730580445)

If no saved session is found, the CLI will display:

No saved WalletConnect session found

WalletConnect Default & Config

You can define a default peer and optional auto-connect setting in ~/.zeta_crypto/config.toml.

Example:

default_peer = "wc:example@2?relay-protocol=irn&symKey=..."
auto_connect = true

Use this configuration to simplify WalletConnect usage:

# Use the default peer from config to connect or disconnect
zeta-cli walletconnect-default connect
zeta-cli walletconnect-default disconnect

# Display current configuration
zeta-cli config-show

Example output:

ZetaConfig { default_peer: Some("wc:example@2?relay-protocol=irn&symKey=..."), auto_connect: Some(true) }

Key Derivation (PBKDF2 / HKDF)

You can derive a secure key from a passphrase using PBKDF2 and HKDF functions implemented in the project.

zeta-cli derive-key --pass "mysecretpassword"

This will generate a deterministic key derived from the given passphrase. The derivation process uses PBKDF2 with HMAC-SHA256 and HKDF for additional entropy expansion.

Example output:

Derived key (hex): 4f3a12c6b7a9c1e3f6d8...

This can be useful for generating session secrets, encryption keys, or other secure materials in crypto-related workflows.


Version & Environment Info

Show CLI version (from Cargo), Rust compiler version, and platform.

zeta-cli version-info

Example output:

Zeta Crypto CLI 0.1.0
Rust compiler: rustc 1.82.0 (000000 2024-10-10)
Platform: macos aarch64

Health Check

Verify presence of local state files.

zeta-cli healthcheck

Checks:

  • Config exists: ~/.zeta_crypto/config.toml
  • Session file exists: ~/.zeta_crypto/session.json
  • Log file exists: ~/.zeta_crypto/logs.txt

Cleanup

Remove local logs and saved sessions (asks for confirmation).

zeta-cli cleanup

Prompt:

This will remove all logs and saved sessions from ~/.zeta_crypto
Type 'yes' to confirm:

Logging

WalletConnect connect/disconnect events are logged to ~/.zeta_crypto/logs.txt with automatic rotation (~256 KB cap).


License

MIT

About

Rust crypto CLI exploring wallets, key derivation, signing, and WalletConnect / Web3 integrations.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages