-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/handle-did-ethr-pkh
- Loading branch information
Showing
46 changed files
with
1,494 additions
and
476 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,3 +79,4 @@ nx-cloud.env | |
.yarn/install-state.gz | ||
.pnp.* | ||
.vscode | ||
.vercel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ apps | |
libs | ||
packages | ||
pnpm-lock.yaml | ||
.vercel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
NEXT_PUBLIC_DEMO_ISSUER=http://localhost:3003 | ||
NEXT_PUBLIC_DEMO_VERIFIER=http://localhost:3004 | ||
|
||
# Prisma | ||
DATABASE_URL= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
datasource db { | ||
provider = "mysql" | ||
url = env("DATABASE_URL") | ||
relationMode = "prisma" | ||
} | ||
|
||
model sessions { | ||
id String @id @default(uuid()) | ||
data String? @db.VarChar(512) | ||
iv String? @db.VarChar(128) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import ConnectedProvider from '@/components/ConnectedProvider'; | ||
import MetaMaskProvider from '@/components/MetaMaskProvider'; | ||
|
||
export default async function ProtectedLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
return ( | ||
<MetaMaskProvider> | ||
<ConnectedProvider>{children}</ConnectedProvider> | ||
</MetaMaskProvider> | ||
); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
packages/dapp/src/app/[locale]/app/(public)/qr-code-session/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Metadata } from 'next'; | ||
|
||
import CreateConnectionCard from '@/components/CreateConnectionCard'; | ||
import ScanConnectionCard from '@/components/ScanConnectionCard'; | ||
|
||
export const metadata: Metadata = { | ||
title: 'Dashboard', | ||
description: 'Dashboard for Masca Dapp.', | ||
}; | ||
|
||
export default function Page() { | ||
return ( | ||
<div className="flex flex-1 flex-col space-y-4 md:flex-row md:space-x-8 md:space-y-0"> | ||
<div className="dark:bg-navy-blue-800 flex flex-1 rounded-3xl bg-white p-4 shadow-lg"> | ||
<CreateConnectionCard /> | ||
</div> | ||
<div className="dark:bg-navy-blue-800 flex flex-1 rounded-3xl bg-white p-4 shadow-lg"> | ||
<ScanConnectionCard /> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
packages/dapp/src/app/api/qr-code-session/[id]/route.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import { NextResponse } from 'next/server'; | ||
|
||
import { prisma } from '@/utils/prisma'; | ||
|
||
export async function GET( | ||
_: Request, | ||
{ params: { id } }: { params: { id: string } } | ||
) { | ||
if (!id) { | ||
return NextResponse.json( | ||
{ error_description: 'Missing sessionId parameter' }, | ||
{ status: 400 } | ||
); | ||
} | ||
|
||
// Get session from database | ||
const session = await prisma.sessions.findUnique({ | ||
where: { | ||
id, | ||
}, | ||
}); | ||
|
||
if (!session) { | ||
return NextResponse.json( | ||
{ error_description: 'Session not found' }, | ||
{ status: 404 } | ||
); | ||
} | ||
|
||
await prisma.sessions.delete({ | ||
where: { | ||
id, | ||
}, | ||
}); | ||
|
||
// Get session data | ||
return NextResponse.json( | ||
{ data: session.data, iv: session.iv }, | ||
{ status: 200 } | ||
); | ||
} | ||
|
||
export async function POST( | ||
request: Request, | ||
{ params: { id } }: { params: { id: string } } | ||
) { | ||
try { | ||
const jsonData = await request.json(); | ||
|
||
const { data, iv } = jsonData; | ||
|
||
if (!id) { | ||
return NextResponse.json( | ||
{ error_description: 'Missing sessionId' }, | ||
{ | ||
status: 400, | ||
} | ||
); | ||
} | ||
|
||
if (!data) { | ||
return NextResponse.json( | ||
{ error_description: "Missing 'data' parameter" }, | ||
{ | ||
status: 400, | ||
} | ||
); | ||
} | ||
|
||
if (!iv) { | ||
return NextResponse.json( | ||
{ error_description: "Missing 'iv' parameter" }, | ||
{ | ||
status: 400, | ||
} | ||
); | ||
} | ||
|
||
// Put session data in database | ||
await prisma.sessions.upsert({ | ||
where: { | ||
id, | ||
}, | ||
update: { | ||
data, | ||
iv, | ||
}, | ||
create: { | ||
id, | ||
data, | ||
iv, | ||
}, | ||
}); | ||
|
||
return new NextResponse(null, { | ||
status: 200, | ||
}); | ||
} catch (e) { | ||
console.log(e); | ||
return NextResponse.json( | ||
{ error_description: 'Bad request' }, | ||
{ | ||
status: 400, | ||
} | ||
); | ||
} | ||
} | ||
|
||
export async function OPTIONS(_: Request) { | ||
return new NextResponse(null, { | ||
status: 200, | ||
headers: { | ||
'Access-Control-Allow-Origin': '*', | ||
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS', | ||
'Access-Control-Allow-Headers': 'Content-Type', | ||
}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.