Skills liberfi-auth
git clone https://github.com/openclaw/skills
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/bombmod/liberfi-auth" ~/.claude/skills/openclaw-skills-liberfi-auth && rm -rf "$T"
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/skills/bombmod/liberfi-auth" ~/.openclaw/skills/openclaw-skills-liberfi-auth && rm -rf "$T"
skills/bombmod/liberfi-auth/SKILL.mdLiberFi Auth
Authenticate with LiberFi and manage your session.
Pre-flight Checks
See bootstrap.md for CLI installation and connectivity verification.
Login Modes
Mode 1 — Key-based Login (recommended for agents)
Generates a P-256 key pair on first use; on subsequent calls, the existing key is reused. No user interaction required — suitable for automated and agent environments.
lfi login key --role AGENT --name "MyAgent" --json
Flow:
- Loads
or generates a new key pair.~/.liberfi/keys/default.json - Signs
(Unix ms string) with the local private key (SHA-256 + ECDSA P-256).Date.now() - Sends
withPOST /v1/auth/key
.{ publicKeyHex, uncompressedPublicKeyHex, timestampMs, signature } - Server verifies the signature and upserts the user record.
- If new user: server creates server-owned EVM + SOL TEE wallets.
- Returns a LiberFi JWT; stored in
.~/.liberfi/session.json
Token refresh:
- Proactive: if the JWT expires in < 60 s, the CLI re-signs a new timestamp and calls
.POST /v1/auth/key - Reactive: on any
response, the CLI attempts one automatic refresh before propagating the error.401
Mode 2 — Email OTP Login (for human users)
Two steps: send OTP, then verify.
Step 1 — Send OTP:
lfi login user@example.com --json
Expected output:
{ "ok": true, "otpId": "uuid-here", "message": "Verification code sent to user@example.com. It expires in 5 minutes." }
Step 2 — Verify OTP:
lfi verify <otpId> <6-digit-code> --json
Expected output:
{ "ok": true, "userId": "...", "role": "HUMAN", "evmAddress": "0x...", "solAddress": "...", "isNewUser": true, "message": "Email verified. Authenticated as ..." }
Notes:
- OTP expires in 5 minutes.
- After verification, the locally generated P-256 key pair is saved as the permanent identity for session auto-refresh.
- Subsequent refreshes work identically to key-based login (no additional email OTPs needed).
Commands
lfi status --json
lfi status --jsonShows current authentication state without a network call.
{ "ok": true, "authenticated": true, "userId": "...", "role": "HUMAN", "evmAddress": "0x...", "solAddress": "...", "expiresInSecs": 82340, "expired": false }
lfi whoami --json
lfi whoami --jsonFetches the current user's profile from the server (requires valid token).
{ "userId": "...", "role": "HUMAN", "displayName": "", "email": "user@example.com", "evmAddress": "0x...", "solAddress": "..." }
lfi logout --json
lfi logout --jsonClears
~/.liberfi/session.json. The JWT is not revoked server-side.
Pre-flight: Authentication Bootstrap
Run this sequence at the start of any operation that requires authentication:
# 1. Connectivity lfi ping --json # 2. Check session state lfi status --json
Decision tree based on
output:lfi status
| | Action |
|---|---|---|
| | Proceed — session is valid |
| | Re-authenticate (token expired) |
| any | Authenticate (no session) |
Agent environment (automated):
lfi login key --role AGENT --name "AgentName" --json lfi whoami --json
Human user (interactive):
lfi login user@example.com --json # → prompt user to enter the 6-digit OTP code lfi verify <otpId> <otp> --json lfi whoami --json
Session Files
| File | Contents |
|---|---|
| JWT, wallet addresses, key material for refresh |
| P-256 key pair (permanent identity) |
| Temporary key pair during email OTP flow |
These files are created with mode
0600 (owner read/write only).
Never share or transmit these files.
Wallet Assignment
After authentication, the user is assigned two server-owned TEE wallets:
| Wallet | Field | Description |
|---|---|---|
| EVM | | Ethereum-compatible wallet (used for EVM swap operations) |
| Solana | | Solana wallet (used for SVM swap operations) |
These wallets are managed by LiberFi's backend. The user's local P-256 private key is never used for on-chain signing.
Website Integration
Users who log in via the LiberFi website (social login) can exchange their identity token for a LiberFi JWT using:
POST /v1/auth/exchange { "identityToken": "<identity-token>" }
This is handled transparently by the website's auth handler — CLI users do not need to interact with this endpoint.
Error Handling
| Error | Meaning | Recovery |
|---|---|---|
| Invalid key or tampered timestamp | Re-generate key pair with |
| System clock skew | Sync system clock |
| OTP TTL elapsed (5 min) | Re-run |
| Wrong 6-digit code | Re-enter code or re-run |
on | JWT expired, refresh failed | Re-authenticate |
on swap/tx commands | Session expired | Run then re-authenticate |
Security Notes
See security-policy.md for global rules.
Skill-specific rules:
- The P-256 private key (
) must be kept secret. Never log, display, or transmit its contents.~/.liberfi/keys/default.json - The session file contains key material for refresh — treat it with the same sensitivity as a private key.
- OTP codes are single-use and expire in 5 minutes — do not store or reuse them.
- LiberFi JWTs expire after 24 hours. Long-running agents should ensure
is called before each API request.ensureSession()