import type { PubkeyStr } from "../shared"; export * from "./client"; export * from "./native"; /** * How a session authenticated, as reported by the backend (derived from which * token verified the request). */ export declare enum AuthMethod { Privy = "privy", Lightcone = "lightcone" } export declare enum ChainType { Solana = "solana", Ethereum = "ethereum" } /** A Privy-managed embedded wallet. */ export interface PrivyEmbeddedWallet { privy_id: string; chain: ChainType; address: string; } /** Privy account data attached to an identity. */ export interface UserPrivyData { /** The Privy DID (`did:privy:...`). */ id: string; /** * Always present: Privy registration provisions the embedded wallet in the * same transaction that creates the user. */ wallet: PrivyEmbeddedWallet; } /** * X account data — the same shape whether X is the login identity or a * connected account on a Google/wallet identity. */ export interface XAccountData { /** X numeric user id (Privy `subject`); absent on legacy rows. */ user_id?: string; username: string; display_name?: string; avatar_url?: string; } /** Google account data for a Google login identity. */ export interface GoogleAccountData { email: string; name?: string; given_name?: string; family_name?: string; avatar_url?: string; } /** Canonical address for a passwordless Email login identity. */ export interface EmailAccountData { email: string; } /** Public login-method names exposed in profiles and bounded conflicts. */ export type LinkedIdentityType = "email" | "google" | "x" | "wallet"; /** Connected Login Identity without repeated Account-level Privy wallet data. */ export type LinkedIdentity = { type: "email"; account: EmailAccountData; } | { type: "google"; account: GoogleAccountData; } | { type: "x"; account: XAccountData; } | { type: "wallet"; address: string; chain: ChainType; }; /** Verified method and canonical identifier that initiated Privy authentication. */ export type LinkedIdentitySelector = { type: "email"; email: string; } | { type: "google"; email: string; } | { type: "x"; username: string; } | { type: "wallet"; address: string; chain: ChainType; }; /** Register-or-sync request naming the verified attempted identity. */ export interface RegisterPrivyRequest { attempted_identity: LinkedIdentitySelector; } /** * The login identity — how the user authenticates. `type` narrows the variant. * * Privy data lives on the variant because its presence is determined by the * identity type: Google/X login only exists via Privy OAuth (guaranteed DID + * embedded wallet), while wallet users opt into Privy (SIWS) or stay * self-custody. */ export type UserIdentity = { type: "email"; account: EmailAccountData; privy: UserPrivyData; } | { type: "google"; account: GoogleAccountData; privy: UserPrivyData; } | { type: "x"; account: XAccountData; privy: UserPrivyData; } | { type: "wallet"; address: string; chain: ChainType; privy?: UserPrivyData; }; /** Full user profile — the `user` object of {@link SessionResponse}. */ export interface User { user_id: string; identity: UserIdentity; /** Every verified login identity connected to the Account, primary first. */ linked_identities?: LinkedIdentity[]; /** Remembered account-wide percentage below 10%; null until one is stored. */ max_slippage_preference: string | null; /** X account connected by a non-X-identity user; absent when identity is X. */ connected_x?: XAccountData; } /** * Session envelope returned by `loginWithMessage`, `register-privy`, and * `GET /api/auth/me`. There is no `wallet_address` field — derive the * session's trading wallet with {@link tradingWallet}. */ export interface SessionResponse { user: User; expires_at: number; auth_method: AuthMethod; is_beta: boolean; } /** Exact decimal-string body used to update and return max slippage. */ export interface MaxSlippagePreferenceBody { max_slippage_preference: string; } /** Human-readable login-method label ("Email" / "Google" / "X" / "Solana"). */ export declare function identityText(identity: UserIdentity): "Email" | "Google" | "X" | "Solana"; /** Privy account data, regardless of identity type. */ export declare function userPrivy(user: User): UserPrivyData | undefined; /** The X account, whether it is the login identity or a connected account. */ export declare function userXAccount(user: User): XAccountData | undefined; /** * The wallet a session operates as. * * Google/X identities only exist via Privy registration, which always * provisions an embedded wallet — that wallet is the answer regardless of * auth method. Wallet identities depend on the session: a Privy (SIWS) * session trades via the embedded wallet, a Lightcone session trades via the * wallet that signed in. */ export declare function tradingWallet(user: User, authMethod: AuthMethod): string; /** Short display label for the wallet a session operates as. */ export declare function walletDisplayName(user: User, authMethod: AuthMethod): string; /** * Best display name for the user. Email addresses are limited to 20 characters; * Google uses `name` with an email fallback; X uses `display_name` with a * username fallback; wallet identities show the shortened address (`FRGk...WcPR`). */ export declare function displayName(user: User): string; /** Avatar URL from the login identity's OAuth provider, if any. */ export declare function avatarUrl(user: User): string | undefined; export interface AuthCredentials { user_id: string; wallet_address: PubkeyStr; expires_at: Date; } export declare function isAuthenticated(credentials?: AuthCredentials): boolean; export declare function generateSigninMessage(nonce: string): Uint8Array; export interface LoginRequest { message: string; signature_bs58: string; pubkey_bytes: number[]; use_embedded_wallet?: boolean; } export interface NonceResponse { nonce: string; } //# sourceMappingURL=index.d.ts.map