Skip to content

Commit

Permalink
chore: rename .env.example, revert last change
Browse files Browse the repository at this point in the history
  • Loading branch information
martines3000 committed Mar 4, 2024
1 parent fc649de commit bfd39a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/dapp/.env.example → packages/dapp/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ POLYGON_MUMBAI_RPC_URL=


# Masca version
NEXT_PUBLIC_MASCA_VERSION=v1.1.0
NEXT_PUBLIC_MASCA_VERSION=

# SupaBase Public
NEXT_PUBLIC_SUPABASE_URL=
Expand Down
13 changes: 3 additions & 10 deletions packages/dapp/src/components/EncryptedSessionProvider/index.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
'use client';

import { useEffect, useState } from 'react';
import { useEffect, useMemo } from 'react';
import { hexToUint8Array } from '@blockchain-lab-um/masca-connector';
import { SupabaseClient } from '@supabase/supabase-js';
import { useTranslations } from 'next-intl';
import { useAccount } from 'wagmi';

import { createClient } from '@/utils/supabase/client';
import { Database } from '@/utils/supabase/database.types';
import { useMascaStore, useToastStore } from '@/stores';
import { useAuthStore } from '@/stores/authStore';
import { useEncryptedSessionStore } from '@/stores/encryptedSessionStore';

export const EncryptedSessionProvider = () => {
const t = useTranslations('EncryptedSessionProvider');
const token = useAuthStore((state) => state.token);
const [client, setClient] = useState<null | SupabaseClient<Database>>(null);

const { address } = useAccount();

Expand All @@ -39,6 +36,8 @@ export const EncryptedSessionProvider = () => {

const api = useMascaStore((state) => state.mascaApi);

const client = useMemo(() => createClient(token ?? ''), [token]);

// Decrypt data
const decryptData = async ({
iv,
Expand Down Expand Up @@ -137,7 +136,6 @@ export const EncryptedSessionProvider = () => {
};

useEffect(() => {
if (!client) return;
if (sessionId && deviceType === 'primary') {
client
.channel('realtime encrypted_sessions')
Expand Down Expand Up @@ -200,10 +198,5 @@ export const EncryptedSessionProvider = () => {
});
}, [address]);

useEffect(() => {
if (!token) return;
setClient(createClient(token));
}, [token]);

return null;
};

0 comments on commit bfd39a1

Please sign in to comment.