Skip to content

Commit

Permalink
Fixed a bug with syncVCs
Browse files Browse the repository at this point in the history
  • Loading branch information
kpachhai committed Feb 20, 2024
1 parent bc224a2 commit d448a1d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"bracket-pair-colorizer-2.depreciation-notice": false,
"editor.guides.bracketPairs": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "explicit"
},
"editor.fontWeight": "normal",
"editor.indentSize": "tabSize"
Expand Down
2 changes: 2 additions & 0 deletions packages/site/src/components/cards/ConfigureGoogleAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ const ConfigureGoogleAccount: FC<Props> = ({
console.error('Login Failed', e);
dispatch({ type: MetamaskActions.SetError, payload: e });
},
scope:
'https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/drive.metadata.readonly',
});

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/tuum-tech/identify.git"
},
"source": {
"shasum": "ECg9tSmTGnEohIna/s0ECP3nGSyo1r3sue3QUU8xwlE=",
"shasum": "0kbQSeKOe9llJ7Wflw6VdUVGUw/zQEyLTxHrb0jsRF0=",
"location": {
"npm": {
"filePath": "dist/snap.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export class GoogleDriveVCStore extends AbstractDataStore {
.filter((item: any) => {
return (
item.metadata.id === (filter.filter as string) &&
item.data.credentialSubject.id?.split(':')[4] === account
item.data.credentialSubject.id?.split(':')[4] ===
this.state.currentAccount.addrToUseForDid
);
});
}
Expand All @@ -95,7 +96,8 @@ export class GoogleDriveVCStore extends AbstractDataStore {
.filter((item: any) => {
return (
item.data.type?.includes(filter.filter as string) &&
item.data.credentialSubject.id?.split(':')[4] === account
item.data.credentialSubject.id?.split(':')[4] ===
this.state.currentAccount.addrToUseForDid
);
});
}
Expand All @@ -113,7 +115,10 @@ export class GoogleDriveVCStore extends AbstractDataStore {
};
})
.filter((item: any) => {
return item.data.credentialSubject.id?.split(':')[4] === account;
return (
item.data.credentialSubject.id?.split(':')[4] ===
this.state.currentAccount.addrToUseForDid
);
});
}

Expand All @@ -130,7 +135,10 @@ export class GoogleDriveVCStore extends AbstractDataStore {
};
})
.filter((item: any) => {
return item.data.credentialSubject.id?.split(':')[4] === account;
return (
item.data.credentialSubject.id?.split(':')[4] ===
this.state.currentAccount.addrToUseForDid
);
});
const filteredObjects = jsonpath.query(objects, filter.filter as string);
return filteredObjects as IQueryResult[];
Expand Down Expand Up @@ -163,7 +171,7 @@ export class GoogleDriveVCStore extends AbstractDataStore {
for (const vc of vcs) {
if (
(vc.vc as VerifiableCredential).credentialSubject.id?.split(':')[4] ===
account
this.state.currentAccount.addrToUseForDid
) {
const newId = vc.id || uuidv4();
newVCs = { ...newVCs, [newId]: vc.vc };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export const verifyToken = async (accessToken: string): Promise<string> => {
if (res.status !== 200) {
throw new Error(data.error_description);
}
console.log('VerifyToken data: ', JSON.stringify(data, null, 4));

return data.email;
} catch (error) {
Expand All @@ -39,7 +38,6 @@ const searchFile = async (accessToken: string, fileName: string) => {
},
);
const data = await res.json();
console.log('searchFile data: ', JSON.stringify(data, null, 4));

const count = data.files.length;

Expand Down Expand Up @@ -109,7 +107,6 @@ export const uploadToGoogleDrive = async (
);
}
const val = await res.json();
console.log({ val });

return val;
} catch (error) {
Expand Down

0 comments on commit d448a1d

Please sign in to comment.