moonpay-auth

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

MoonPay auth and setup

MoonPay 身份验证与配置

Install

安装

bash
npm i -g @moonpay/cli
This installs the
mp
(and
moonpay
) binary globally.
bash
npm i -g @moonpay/cli
这会全局安装
mp
(以及
moonpay
)二进制文件。

Verify installation

验证安装

bash
mp --version
mp --help
bash
mp --version
mp --help

Auth commands

身份验证命令

bash
undefined
bash
undefined

Log in (sends OTP to email)

登录(向邮箱发送一次性验证码OTP)

mp login --email user@example.com
mp login --email user@example.com

Verify OTP code

验证OTP验证码

mp verify --email user@example.com --code 123456
mp verify --email user@example.com --code 123456

Check current user

查看当前登录用户

mp user retrieve
mp user retrieve

Log out

登出

mp logout
undefined
mp logout
undefined

Local wallet management

本地钱包管理

The CLI manages local wallets stored encrypted in
~/.config/moonpay/wallets.json
. Private keys are encrypted with AES-256-GCM using a random key stored in your OS keychain. No password required — keys never leave the machine.
bash
undefined
该CLI管理加密存储在
~/.config/moonpay/wallets.json
中的本地钱包。私钥使用存储在操作系统钥匙串中的随机密钥,通过AES-256-GCM算法加密。无需密码,密钥永远不会离开本机。
bash
undefined

Create a new HD wallet (Solana, Ethereum, Bitcoin, Tron)

创建新的HD钱包(支持Solana、Ethereum、Bitcoin、Tron)

mp wallet create --name "my-wallet"
mp wallet create --name "my-wallet"

Import from a mnemonic (all chains)

从助记词导入(支持所有链)

mp wallet import --name "restored" --mnemonic "word1 word2 ..."
mp wallet import --name "restored" --mnemonic "word1 word2 ..."

Import from a private key (single chain)

从私钥导入(仅支持单链)

mp wallet import --name "imported" --key <hex-key> --chain ethereum
mp wallet import --name "imported" --key <hex-key> --chain ethereum

List all local wallets

列出所有本地钱包

mp wallet list
mp wallet list

Get wallet details (by name or address)

获取钱包详情(可按名称或地址查询)

mp wallet retrieve --wallet "my-wallet"
mp wallet retrieve --wallet "my-wallet"

Export mnemonic/key (interactive only — agents cannot run this)

导出助记词/私钥(仅支持交互式操作,Agent无法运行该命令)

mp wallet export --wallet "my-wallet"
mp wallet export --wallet "my-wallet"

Delete a wallet (irreversible)

删除钱包(操作不可撤销)

mp wallet delete --wallet "my-wallet" --confirm
undefined
mp wallet delete --wallet "my-wallet" --confirm
undefined

Workflow

工作流

  1. Run
    mp user retrieve
    to check if authenticated.
  2. If it fails, run
    mp login --email <email>
    , then
    mp verify --email <email> --code <code>
    .
  3. Run
    mp wallet list
    to see local wallets.
  4. If no wallets, create one:
    mp wallet create --name "default"
    .
  1. 执行
    mp user retrieve
    检查是否已完成身份验证。
  2. 如果执行失败,运行
    mp login --email <邮箱地址>
    ,然后运行
    mp verify --email <邮箱地址> --code <验证码>
  3. 运行
    mp wallet list
    查看本地钱包列表。
  4. 如果没有钱包,可创建一个:
    mp wallet create --name "default"

Autonomous login

自主登录

Agents can log in without human intervention if they have access to the user's email. For example, with the
gog
CLI (Google Workspace):
bash
undefined
Agent如果能够访问用户的邮箱,即可无需人工干预完成登录。例如使用
gog
CLI(Google Workspace工具):
bash
undefined

1. Send OTP

1. 发送OTP验证码

mp login --email user@example.com
mp login --email user@example.com

2. Read the OTP code from email

2. 从邮箱中读取OTP验证码

gog gmail search "Your MoonPay verification code" --max-results 1
gog gmail search "Your MoonPay verification code" --max-results 1

3. Verify with the code

3. 使用验证码完成验证

mp verify --email user@example.com --code <code>

This enables fully autonomous agent setup — no human in the loop.
mp verify --email user@example.com --code <code>

这可实现完全自主的Agent配置,无需人工参与流程。

Config locations

配置文件位置

  • Wallets:
    ~/.config/moonpay/wallets.json
    (encrypted, AES-256-GCM)
  • Encryption key: OS keychain (
    moonpay-cli
    /
    encryption-key
    )
  • Credentials:
    ~/.config/moonpay/credentials.json
    (encrypted, AES-256-GCM)
  • Config:
    ~/.config/moonpay/config.json
    (base URL, client ID)
  • 钱包文件:
    ~/.config/moonpay/wallets.json
    (AES-256-GCM加密)
  • 加密密钥: 操作系统钥匙串(
    moonpay-cli
    /
    encryption-key
  • 凭证信息:
    ~/.config/moonpay/credentials.json
    (AES-256-GCM加密)
  • 配置文件:
    ~/.config/moonpay/config.json
    (存储基础URL、客户端ID)

Security

安全说明

  • Wallet secrets are always encrypted on disk
  • Encryption key is stored in macOS Keychain / Linux libsecret
  • No password to remember — the OS handles authentication
  • wallet export
    requires an interactive terminal (TTY) — agents and scripts cannot extract secrets
  • 24-word BIP39 mnemonics (256-bit entropy)
  • 钱包密钥始终在磁盘上加密存储
  • 加密密钥存储在macOS Keychain / Linux libsecret中
  • 无需记忆密码,由操作系统处理身份验证
  • wallet export
    命令需要交互式终端(TTY),Agent和脚本无法导出密钥
  • 采用24词BIP39助记词(256位熵)

Related skills

相关技能

  • moonpay-swap-tokens — Swap or bridge tokens using local wallets.
  • moonpay-check-wallet — Check wallet balances.
  • moonpay-swap-tokens — 使用本地钱包兑换或跨链转移代币
  • moonpay-check-wallet — 查看钱包余额