Refactoring Provider setup of Google Auth

This commit is contained in:
Samuel Andert
2023-07-25 09:34:31 +02:00
parent 50b0fca034
commit 44d668d7af
7 changed files with 46 additions and 40 deletions

View File

@ -0,0 +1,30 @@
// litProviderSetup.ts
import {
LitAuthClient,
GoogleProvider,
BaseProvider,
} from '@lit-protocol/lit-auth-client';
import { ProviderType } from '@lit-protocol/constants';
import { LitNodeClient } from '@lit-protocol/lit-node-client';
let provider: BaseProvider | undefined;
export async function setupLitProvider() {
const litNodeClient = new LitNodeClient({
litNetwork: 'serrano',
debug: false
});
await litNodeClient.connect();
const litAuthClient = new LitAuthClient({
litRelayConfig: {
relayApiKey: 'test-api-key'
},
litNodeClient
});
provider = litAuthClient.initProvider<GoogleProvider>(ProviderType.Google);
return provider;
}