-
Notifications
You must be signed in to change notification settings - Fork 86
/
index.ts
29 lines (23 loc) · 890 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* istanbul ignore file */
import { SDKBase, createSDK } from '@magic-sdk/provider';
import localForage from 'localforage';
import * as memoryDriver from 'localforage-driver-memory';
import { IframeController } from './iframe-controller';
export * from '@magic-sdk/commons';
export const Magic = createSDK(SDKBase, {
platform: 'web',
sdkName: 'magic-sdk',
version: process.env.WEB_VERSION!,
defaultEndpoint: 'https://auth.magic.link/',
ViewController: IframeController,
configureStorage: /* istanbul ignore next */ async () => {
const lf = localForage.createInstance({
name: 'MagicAuthLocalStorageDB',
storeName: 'MagicAuthLocalStorage',
});
await lf.defineDriver(memoryDriver);
await lf.setDriver([localForage.INDEXEDDB, localForage.LOCALSTORAGE, memoryDriver._driver]);
return lf;
},
});
export type Magic = InstanceType<typeof Magic>;