UNPKG

@lit-protocol/auth-browser

Version:

Browser-specific authentication utilities for the Lit Protocol, enabling seamless connection to various blockchain networks including Ethereum, Cosmos, and Solana.

73 lines (72 loc) 1.75 kB
import { AuthSig, CosmosWalletType } from '@lit-protocol/types'; /** ---------- Declaration ---------- */ declare global { interface Window { keplr?: any; leap?: any; solana?: any; } } /** ---------- Local Interfaces ---------- */ interface CosmosProvider { provider: any; account: string; chainId: string | number; } interface CosmosSignDoc { chain_id: string; account_number: string; sequence: string; fee: { gas: string; amount: []; }; msgs: Array<{ type: string; value: { signer: any; data: any; }; }>; memo: string; } /** ---------- Exports ---------- */ /** * * Get cosmos provider details * * @property { string } chain */ export declare const connectCosmosProvider: ({ chain, walletType, }: { chain: string; walletType: CosmosWalletType; }) => Promise<CosmosProvider>; /** * * Check if the cosmos signature is in the local storage already, * If not, sign and save the authenticated message * * @property { string } chain * @returns { AuthSig } */ export declare const checkAndSignCosmosAuthMessage: ({ chain, walletType, }: { chain: string; walletType: CosmosWalletType; }) => Promise<AuthSig>; /** * * Save and sign the authenticated message * @param { CosmosProvider } connectedCosmosProvider * * @returns { void } */ export declare const signAndSaveAuthMessage: (connectedCosmosProvider: CosmosProvider) => Promise<void>; /** * * Turn sorted signDoc object into uint8array * * @param { CosmosSignDoc } signDoc * @returns { Uint8Array } serialized string in uint8array */ export declare const serializeSignDoc: (signDoc: CosmosSignDoc) => Uint8Array; export {};