Expand description
Tempo wallet device-code authorization flow.
Implements the CLI side of the tempoxyz/accounts cli-auth device-code
protocol: generates a local secp256k1 access key, creates a PKCE-protected
device code, opens wallet.tempo.xyz/cli-auth?code=<CODE> in the browser,
polls until the user authorizes the key on their passkey wallet, and writes
the resulting access key to the Tempo Accounts store.json.
Re-exportsΒ§
use alloy_primitives::Address;πuse alloy_primitives::B256;πuse alloy_primitives::hex;πuse alloy_primitives::hex;πuse alloy_signer_local::PrivateKeySigner;πuse base64::Engine;πuse base64::engine::general_purpose::URL_SAFE_NO_PAD;πuse eyre::Result;πuse serde::Deserialize;πuse serde::Deserialize;πuse serde::Serialize;πuse serde::Serialize;πuse sha2::Digest;πuse sha2::Sha256;πuse std::env;πuse std::env;πuse std::sync::LazyLock;πuse std::time::Duration;πuse std::time::Instant;πuse tempo_alloy::accounts::TempoAccountsKeyAuthorization;πuse tempo_alloy::accounts::TempoAccountsStore;πuse tempo_primitives::transaction::SignatureType;πuse tempo_primitives::transaction::SignedKeyAuthorization;πuse tokio::sync::Mutex;πuse std::process::Command;πUnix or Windows
StructsΒ§
- Access
KeyOutcome - Result of
ensure_access_key. - Create
Code πRequest - Create
Code πResponse - Ensure
Access KeyConfig - Configuration for
ensure_access_key. - Poll
Request π
EnumsΒ§
- Poll
KeyAuthorization π - Poll
Response π - Matches
tempoxyz/walletpoll response shape.
ConstantsΒ§
- DEFAULT_
CLI_ πAUTH_ URL - Default device-code service URL (production wallet.tempo.xyz).
- DEFAULT_
POLL_ πINTERVAL - DEFAULT_
TIMEOUT π - TEMPO_
CLI_ πAUTH_ URL_ ENV - Env var to override the device-code service URL (for tests / staging).
StaticsΒ§
- AUTH_
LOCK π - Per-process serialization of concurrent
ensure_access_keycalls.
FunctionsΒ§
- create_
code_ πwith_ retry - POST
/codewith exponential backoff on transient errors, bounded bytimeout. - ensure_
access_ key - Run the device-code flow, persist the resulting key to
store.json, and return the new entryβs identifying fields. - is_
known_ πtempo_ endpoint - Returns
trueifurlβs host istempo.xyzor a subdomain of it. - is_
transient_ πerror - is_
transient_ πstatus - open_
browser π - Open
urlvia the OS default browser handler. On platforms without a known opener, this is a no-op (the URL is still printed byensure_access_key). - random_
code_ πverifier - serialize_
u64_ πhex - sha256_
b64url π