UNPKG

caplib

Version:

Credentialless Authentication Protocol Library for Web Applications

64 lines (63 loc) 1.47 kB
import { AuthProvider, theme_default, useAuth, withAuth } from "../chunk-743756IX.mjs"; import { CapAuth, OnboardingForm } from "../chunk-RYE5TPNM.mjs"; // src/react/utils.ts import { clsx } from "clsx"; import { twMerge } from "tailwind-merge"; function cn(...inputs) { return twMerge(clsx(inputs)); } function isValidWalletAddress(address) { return /^0x[a-fA-F0-9]{40}$/.test(address); } function createGradient(from, to) { return `bg-gradient-to-r from-${from}-400 via-${from}-500 to-${to}-600`; } function formatErrorMessage(error) { if (error instanceof Error) { return error.message; } if (typeof error === "string") { return error; } return "An unexpected error occurred"; } function getRandomNonce() { return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); } function formatWalletAddress(address) { if (!address) return ""; return `${address.slice(0, 6)}...${address.slice(-4)}`; } var fadeIn = { hidden: { opacity: 0 }, visible: { opacity: 1, transition: { duration: 0.2 } } }; var slideUp = { hidden: { opacity: 0, y: 20 }, visible: { opacity: 1, y: 0, transition: { duration: 0.3 } } }; export { AuthProvider, CapAuth, OnboardingForm, theme_default as capAuthTheme, cn, createGradient, fadeIn, formatErrorMessage, formatWalletAddress, getRandomNonce, isValidWalletAddress, slideUp, useAuth, withAuth }; //# sourceMappingURL=index.mjs.map