@arcana/auth
Version:
Arcana Auth
54 lines (53 loc) • 2.56 kB
TypeScript
import { ConstructorParams, WalletPosition, Theme, Network } from './typings';
declare const getFallbackImage: (t: Theme) => string;
declare const ICONS: {
success: string;
fail: string;
};
type elements = 'style' | 'src' | 'onclick' | 'id' | 'onerror' | 'allow' | 'className';
declare const createDomElement: (type: string, props: Partial<{
style: string | object | (() => void);
src: string | object | (() => void);
onclick: string | object | (() => void);
id: string | object | (() => void);
onerror: string | object | (() => void);
allow: string | object | (() => void);
className: string | object | (() => void);
}>, ...children: (string | HTMLElement)[]) => HTMLElement;
declare const setWalletPosition: (element: HTMLElement, position: WalletPosition) => void;
declare const getErrorReporter: () => (m: string) => void;
declare const constructLoginUrl: (params: {
loginType: string;
email?: string;
sessionId?: string;
setToken?: string;
appId: string;
authUrl: string;
parentUrl: string;
}) => string;
declare const redirectTo: (url: string) => void;
declare const validateAppAddress: (arg: unknown) => void;
declare const isClientId: (id: string | undefined | null) => boolean;
declare const getParamsFromClientId: (id: string) => {
network: Network;
address: string;
};
declare const addHexPrefix: (i: string) => string;
declare const removeHexPrefix: (i: string) => string;
declare const getHexFromNumber: (n: number, prefix?: boolean) => string;
declare const setFallbackImage: (e: Event, theme: Theme) => void;
declare const getCurrentUrl: () => string;
declare const getConstructorParams: (initParams?: Partial<ConstructorParams>) => ConstructorParams;
declare const getUniqueId: () => number;
declare function preLoadIframe(url: string, appId: string): void;
export declare function encodeJSON<T>(options: T): string;
export declare function onWindowReady(fn: () => void): void;
export { ICONS, constructLoginUrl, createDomElement, setWalletPosition, getUniqueId, preLoadIframe, getErrorReporter, validateAppAddress, addHexPrefix, removeHexPrefix, redirectTo, setFallbackImage, getFallbackImage, getHexFromNumber, getCurrentUrl, getConstructorParams, getParamsFromClientId, isClientId, };
/**
* Given a JSON-serializable object, encode as a Base64-URL string.
*/
export declare function encodeJSONToBase64(options: unknown): string;
/**
* Given a Base64-URL JSON string, decode a JavaScript object.
*/
export declare function decodeBase64ToJSON<T>(queryString: string): T;