diff --git a/cmd/wallet-web/src/layouts/WACILayout.vue b/cmd/wallet-web/src/layouts/WACILayout.vue
index 2d43ec4f..d6e8e073 100644
--- a/cmd/wallet-web/src/layouts/WACILayout.vue
+++ b/cmd/wallet-web/src/layouts/WACILayout.vue
@@ -14,7 +14,7 @@
class="flex flex-row justify-start items-center outline-none focus:ring-2 focus:ring-primary-purple focus:ring-offset-2"
@click="handleBackButtonClick"
>
-
+
-
+
@@ -35,7 +35,7 @@
/>
diff --git a/cmd/wallet-web/src/mixins/common/register.js b/cmd/wallet-web/src/mixins/common/register.js
index 80452f6b..bc10359f 100644
--- a/cmd/wallet-web/src/mixins/common/register.js
+++ b/cmd/wallet-web/src/mixins/common/register.js
@@ -99,6 +99,7 @@ export class RegisterWallet {
async _createDefaultVault(profile) {
let { user, token } = profile;
let name = 'Default Vault';
+ console.log('_createDefaultVault this.agent', this.agent);
let collectionManager = new CollectionManager({ agent: this.agent, user });
let vaultID = await collectionManager.create(token, { name });
if (vaultID) {
diff --git a/cmd/wallet-web/src/mixins/gnap/gnap.js b/cmd/wallet-web/src/mixins/gnap/gnap.js
index 2bb4c1db..edb9a874 100644
--- a/cmd/wallet-web/src/mixins/gnap/gnap.js
+++ b/cmd/wallet-web/src/mixins/gnap/gnap.js
@@ -5,6 +5,7 @@ SPDX-License-Identifier: Apache-2.0
*/
import { GNAPClient } from '@trustbloc/wallet-sdk';
+import { getGnapKeyPair } from '@/mixins';
export async function gnapRequestAccess(
signer,
@@ -45,3 +46,58 @@ export async function gnapContinue(signer, gnapAuthServerURL, interactRef, acces
const resp = await gnapClient.continue(gnapContinueReq, accessToken);
return resp;
}
+
+export async function initiateGnapAuth(store, router) {
+ const gnapAccessTokens = await store.getters['getGnapAccessTokenConfig'];
+ const gnapAuthServerURL = store.getters.hubAuthURL;
+ const walletWebUrl = store.getters.walletWebUrl;
+ const gnapKeyPair = await getGnapKeyPair();
+ console.log('gnapKeyPair', gnapKeyPair);
+ const signer = { SignatureVal: gnapKeyPair };
+ console.log('signer', signer.SignatureVal);
+ const clientNonceVal = (Math.random() + 1).toString(36).substring(7);
+
+ console.log(
+ 'requestAccess with:',
+ JSON.stringify(
+ {
+ ...signer,
+ gnapAccessTokens,
+ gnapAuthServerURL,
+ walletWebUrl,
+ clientNonceVal,
+ },
+ null,
+ 2
+ )
+ );
+
+ const resp = await gnapRequestAccess(
+ signer,
+ gnapAccessTokens,
+ gnapAuthServerURL,
+ walletWebUrl,
+ clientNonceVal
+ );
+ console.log('resp', resp);
+ // If user have already signed in then just redirect
+ if (resp.data.access_token) {
+ const accessToken = resp.data.access_token[0].value;
+ const subjectId = resp.data.subject.sub_ids[0].id;
+ console.log('111 new accessToken', accessToken);
+ console.log('111 new subjectId', subjectId);
+ store.dispatch('updateSessionToken', accessToken);
+ store.dispatch('updateSubjectId', subjectId);
+ router.push({ name: 'DashboardLayout' });
+ return;
+ }
+ const respMetaData = {
+ uri: resp.data.continue.uri,
+ continue_access_token: resp.data.continue.access_token,
+ finish: resp.data.interact.finish,
+ clientNonceVal: clientNonceVal,
+ };
+ await store.dispatch('updateGnapReqAccessResp', respMetaData);
+ console.log('redirect to:', resp.data.interact.redirect);
+ return resp.data.interact.redirect;
+}
diff --git a/cmd/wallet-web/src/mixins/gnap/store.js b/cmd/wallet-web/src/mixins/gnap/store.js
index a19f58e7..cfe8f413 100644
--- a/cmd/wallet-web/src/mixins/gnap/store.js
+++ b/cmd/wallet-web/src/mixins/gnap/store.js
@@ -10,6 +10,7 @@ const storekey = 'gnap';
export async function getGnapKeyPair() {
const gnapKeyPair = await fetchStoredGnapKeyPair();
+ console.log('fetched gnapKeyPair', gnapKeyPair);
if (gnapKeyPair === undefined) {
return createAndStoreGnapKeyPair();
}
diff --git a/cmd/wallet-web/src/pages/BlockNoAuthPage.vue b/cmd/wallet-web/src/pages/BlockNoAuthPage.vue
index 30bf493f..c5c48874 100644
--- a/cmd/wallet-web/src/pages/BlockNoAuthPage.vue
+++ b/cmd/wallet-web/src/pages/BlockNoAuthPage.vue
@@ -5,16 +5,16 @@
-->
-
+
-
Access Denied
-
+
You don't have authorization to access this page, please sign in to your wallet and try
again.
diff --git a/cmd/wallet-web/src/pages/CHAPISharePage.vue b/cmd/wallet-web/src/pages/CHAPISharePage.vue
index eab5a2ae..871a64f7 100644
--- a/cmd/wallet-web/src/pages/CHAPISharePage.vue
+++ b/cmd/wallet-web/src/pages/CHAPISharePage.vue
@@ -116,7 +116,7 @@ function focusStyleColor(color) {
-
+
@@ -124,7 +124,7 @@ function focusStyleColor(color) {
-
+
@@ -137,17 +137,17 @@ function focusStyleColor(color) {
-
{{
+ {{
t('CHAPI.Share.Error.heading')
}}
- {{
+ {{
t('CHAPI.Share.Error.body')
}}
@@ -161,16 +161,16 @@ function focusStyleColor(color) {
-
+
-
{{
+ {{
t('CHAPI.Share.CredentialsMissing.heading')
}}
- {{
+ {{
t('CHAPI.Share.CredentialsMissing.body')
}}
@@ -186,24 +186,24 @@ function focusStyleColor(color) {