Files
TheGame/packages/web/lib/auth.ts
Pacien Boisson a02d864c9e Support connection from smart wallets (#416)
* Support connection from smart wallets

* Fix unreachable code
2021-03-16 17:42:07 +04:00

19 lines
655 B
TypeScript

import { get, remove, set } from './store';
const STORAGE_KEY = 'metagame-auth-token';
const walletconnectKey = 'walletconnect';
const mobileLinkChoiceKey = 'WALLETCONNECT_DEEPLINK_CHOICE';
export const getTokenFromStore = (): string | null => get(STORAGE_KEY);
export const setTokenInStore = (token: string): void => set(STORAGE_KEY, token);
export const clearToken = (): void => remove(STORAGE_KEY);
// Temporary workaround to clear cached walletconnect mobile wallet
// https://github.com/WalletConnect/walletconnect-monorepo/issues/394
export const clearWalletConnect = (): void => {
remove(walletconnectKey);
remove(mobileLinkChoiceKey);
};