generated from rpidanny/typescript-package-template
-
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 #212 from threefoldtech/main_signing-data
Main signing data
- Loading branch information
Showing
7 changed files
with
363 additions
and
18 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
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,23 +1,30 @@ | ||
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'; | ||
import {createRouter, createWebHistory, RouteRecordRaw} from 'vue-router'; | ||
import Home from '../views/Home.vue'; | ||
|
||
const routes: Array<RouteRecordRaw> = [ | ||
{ | ||
path: '/', | ||
name: 'Home', | ||
component: Home, | ||
}, | ||
{ | ||
path: '/callback', | ||
name: 'Callback', | ||
component: () => | ||
import(/* webpackChunkName: "about" */ '../views/Callback.vue'), | ||
}, | ||
{ | ||
path: '/', | ||
name: 'Home', | ||
component: Home, | ||
}, | ||
{ | ||
path: '/callback', | ||
name: 'Callback', | ||
component: () => | ||
import(/* webpackChunkName: "about" */ '../views/Callback.vue'), | ||
}, | ||
{ | ||
path: '/callbackSign', | ||
name: 'CallbackSign', | ||
component: () => | ||
import(/* webpackChunkName: "about" */ '../views/CallbackSign.vue'), | ||
}, | ||
|
||
]; | ||
|
||
const router = createRouter({ | ||
history: createWebHistory(process.env.BASE_URL), | ||
routes, | ||
history: createWebHistory(process.env.BASE_URL), | ||
routes, | ||
}); | ||
|
||
export default router; |
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,74 @@ | ||
<template> | ||
|
||
</template> | ||
|
||
<script lang="ts"> | ||
import {defineComponent} from "vue"; | ||
import {ThreefoldLogin} from "@threefoldjimber/threefold_login/dist"; | ||
import {environment, ProductionConfig, StagingConfig} from "@/config/config"; | ||
import {Configurations} from "@/enums"; | ||
import router from "@/router"; | ||
export default defineComponent({ | ||
async setup () { | ||
console.log(router.currentRoute.value.query) | ||
console.log(router.currentRoute.value.query['error']) | ||
if (router.currentRoute.value.query['error']) { | ||
window.opener.postMessage({message: 'threefoldSignCancel'}); | ||
return; | ||
} | ||
let login: ThreefoldLogin; | ||
switch (environment.value) { | ||
case Configurations.STAGING: | ||
login = new ThreefoldLogin(StagingConfig.threefoldBackend, | ||
StagingConfig.appId, | ||
StagingConfig.seedPhrase, | ||
'/callbackSign', | ||
StagingConfig.kycBackend); | ||
break; | ||
case Configurations.PRODUCTION: | ||
login = new ThreefoldLogin(ProductionConfig.threefoldBackend, | ||
ProductionConfig.appId, | ||
ProductionConfig.seedPhrase, | ||
'/callbackSign', | ||
ProductionConfig.kycBackend); | ||
break; | ||
default: | ||
login = new ThreefoldLogin(ProductionConfig.threefoldBackend, | ||
ProductionConfig.appId, | ||
ProductionConfig.seedPhrase, | ||
'/callbackSign', | ||
ProductionConfig.kycBackend); | ||
} | ||
await login.init(); | ||
const state = window.localStorage.getItem("state") as string | ||
const redirectUrl = new URL(window.location.href) | ||
try { | ||
console.log('Trying this') | ||
const profileData = await login.parseAndValidateRedirectUrlForSigning(redirectUrl, state); | ||
console.log('THIS IS THE PROFILE DATA'); | ||
console.log(profileData) | ||
window.opener.postMessage({message: 'threefoldSignRedirectSuccess', profileData: profileData}); | ||
} catch (e) { | ||
console.log('This is the error') | ||
console.error("Error", e) | ||
} | ||
} | ||
}) | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
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.