-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from JustaName-id/develop
Develop
- Loading branch information
Showing
49 changed files
with
21,130 additions
and
20,134 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
VITE_APP_API_DOMAIN=<your-vc-api-domain>/verifications/v1 | ||
VITE_APP_ENVIRONMENT=<YOUR_ENVIRONMENT># (development, production, staging, test) | ||
VITE_APP_OPENPASSPORT_SCOPE=<YOUR_OPENPASSPORT_SCOPE> |
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,18 @@ | ||
{ | ||
"extends": ["plugin:@nx/react", "../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
} | ||
] | ||
} |
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 @@ | ||
.env |
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 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>OpenpassportStatic</title> | ||
<base href="/" /> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link rel="icon" type="image/x-icon" href="/favicon.ico" /> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
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,11 @@ | ||
/* eslint-disable */ | ||
export default { | ||
displayName: 'openpassport-static', | ||
preset: '../../jest.preset.js', | ||
transform: { | ||
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', | ||
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], | ||
}, | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], | ||
coverageDirectory: '../../coverage/apps/openpassport-static', | ||
}; |
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,9 @@ | ||
{ | ||
"name": "openpassport-static", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "apps/openpassport-static/src", | ||
"projectType": "application", | ||
"tags": [], | ||
"// targets": "to see all targets run: nx show project openpassport-static --web", | ||
"targets": {} | ||
} |
Binary file not shown.
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,52 @@ | ||
import axios from 'axios'; | ||
import { OpenPassportQRcode } from '@openpassport/qrcode'; | ||
import { OpenPassportAttestation, OpenPassportVerifier } from '@openpassport/core'; | ||
|
||
export function App() { | ||
const address = new URLSearchParams(window.location.search).get('address'); | ||
const state = new URLSearchParams(window.location.search).get('state'); | ||
|
||
const environment = import.meta.env.VITE_APP_ENVIRONMENT; | ||
const scope = import.meta.env.VITE_APP_OPENPASSPORT_SCOPE; | ||
let openPassportVerifier = new OpenPassportVerifier('prove_offchain', scope); | ||
|
||
if (environment === 'development' || environment === 'staging') { | ||
openPassportVerifier = openPassportVerifier.allowMockPassports(); | ||
} | ||
|
||
const callback = async (attestation: OpenPassportAttestation) => { | ||
try { | ||
const encodedAttestation = btoa(JSON.stringify(attestation)); | ||
|
||
await axios.get( | ||
`${import.meta.env.VITE_APP_API_DOMAIN}/credentials/socials/openpassport/callback`, | ||
{ | ||
params: { | ||
code: encodedAttestation, | ||
state: state, | ||
}, | ||
} | ||
); | ||
} catch (error) { | ||
console.error('Error in callback:', error); | ||
} | ||
} | ||
|
||
if (!address || !state) { | ||
return <h2>Please provide an address parameter in the URL to continue</h2>; | ||
} | ||
|
||
return ( | ||
<OpenPassportQRcode | ||
appName={scope} | ||
userId={address.replace("0x", "")} | ||
userIdType={"hex"} | ||
openPassportVerifier={openPassportVerifier} | ||
onSuccess={async (attestation) => { | ||
await callback(attestation); | ||
}} | ||
/> | ||
); | ||
} | ||
|
||
export default App; |
Empty file.
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,16 @@ | ||
import { Buffer } from 'buffer'; | ||
import { StrictMode } from 'react'; | ||
import * as ReactDOM from 'react-dom/client'; | ||
|
||
import App from './app/app'; | ||
|
||
window.Buffer = Buffer; | ||
|
||
const root = ReactDOM.createRoot( | ||
document.getElementById('root') as HTMLElement | ||
); | ||
root.render( | ||
<StrictMode> | ||
<App /> | ||
</StrictMode> | ||
); |
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,23 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"types": [ | ||
"node", | ||
"@nx/react/typings/cssmodule.d.ts", | ||
"@nx/react/typings/image.d.ts", | ||
"vite/client" | ||
] | ||
}, | ||
"exclude": [ | ||
"src/**/*.spec.ts", | ||
"src/**/*.test.ts", | ||
"src/**/*.spec.tsx", | ||
"src/**/*.test.tsx", | ||
"src/**/*.spec.js", | ||
"src/**/*.test.js", | ||
"src/**/*.spec.jsx", | ||
"src/**/*.test.jsx" | ||
], | ||
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.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,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"jsx": "react-jsx", | ||
"allowJs": false, | ||
"esModuleInterop": false, | ||
"allowSyntheticDefaultImports": true, | ||
"strict": true, | ||
"types": ["vite/client"] | ||
}, | ||
"files": [], | ||
"include": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.app.json" | ||
}, | ||
{ | ||
"path": "./tsconfig.spec.json" | ||
} | ||
], | ||
"extends": "../../tsconfig.base.json" | ||
} |
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,25 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"module": "commonjs", | ||
"types": [ | ||
"jest", | ||
"node", | ||
"@nx/react/typings/cssmodule.d.ts", | ||
"@nx/react/typings/image.d.ts" | ||
] | ||
}, | ||
"include": [ | ||
"jest.config.ts", | ||
"src/**/*.test.ts", | ||
"src/**/*.spec.ts", | ||
"src/**/*.test.tsx", | ||
"src/**/*.spec.tsx", | ||
"src/**/*.test.js", | ||
"src/**/*.spec.js", | ||
"src/**/*.test.jsx", | ||
"src/**/*.spec.jsx", | ||
"src/**/*.d.ts" | ||
] | ||
} |
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,40 @@ | ||
/// <reference types='vitest' /> | ||
import { defineConfig } from 'vite'; | ||
import react from '@vitejs/plugin-react'; | ||
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; | ||
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin'; | ||
|
||
export default defineConfig({ | ||
root: __dirname, | ||
cacheDir: '../../node_modules/.vite/apps/openpassport-static', | ||
|
||
define: { | ||
'global': {}, | ||
}, | ||
|
||
server: { | ||
port: 4200, | ||
host: 'localhost', | ||
}, | ||
|
||
preview: { | ||
port: 4300, | ||
host: 'localhost', | ||
}, | ||
|
||
plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])], | ||
|
||
// Uncomment this if you are using workers. | ||
// worker: { | ||
// plugins: [ nxViteTsPaths() ], | ||
// }, | ||
|
||
build: { | ||
outDir: '../../dist/apps/openpassport-static', | ||
emptyOutDir: true, | ||
reportCompressedSize: true, | ||
commonjsOptions: { | ||
transformMixedEsModules: true, | ||
}, | ||
}, | ||
}); |
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
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
16 changes: 16 additions & 0 deletions
16
apps/vc-api/src/api/filters/verify-records/verification-failed.filter.ts
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,16 @@ | ||
import { BaseExceptionFilter } from '@nestjs/core'; | ||
import { ArgumentsHost, Catch, HttpStatus } from '@nestjs/common'; | ||
import { VerificationFailedException } from '../../../core/domain/exceptions/VerificationFailed.exception'; | ||
|
||
@Catch(VerificationFailedException) | ||
export class VerificationFailedExceptionFilter extends BaseExceptionFilter { | ||
catch(exception: VerificationFailedException, host: ArgumentsHost) { | ||
const context = host.switchToHttp(); | ||
const response = context.getResponse(); | ||
const httpStatus = HttpStatus.BAD_REQUEST; | ||
|
||
response.status(httpStatus).json({ | ||
message: exception.message, | ||
}); | ||
} | ||
} |
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.