From 8061655896618317e4a4e12667e0c4f9770d508c Mon Sep 17 00:00:00 2001 From: Hjort Date: Wed, 23 Aug 2023 15:36:41 +0200 Subject: [PATCH 1/5] Save temporary VCmetadata to display pending VC + handle credentialEntry not existing --- packages/browser-wallet/CHANGELOG.md | 6 ++++++ .../AddWeb3IdCredential.tsx | 6 +++++- .../VerifiableCredentialHooks.tsx | 19 +++++++++++++++---- .../browser-wallet/src/popup/store/utils.ts | 5 +++++ .../src/popup/store/verifiable-credential.ts | 4 ++++ .../src/shared/storage/access.ts | 4 ++++ .../src/shared/storage/types.ts | 1 + .../utils/verifiable-credential-helpers.ts | 18 +++++++++++------- 8 files changed, 51 insertions(+), 12 deletions(-) diff --git a/packages/browser-wallet/CHANGELOG.md b/packages/browser-wallet/CHANGELOG.md index b0f5000fa..69f68cadd 100644 --- a/packages/browser-wallet/CHANGELOG.md +++ b/packages/browser-wallet/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixed + +- Show verifiable credentials in overview before they are put on chain. + ## 1.1.1 ### Fixed diff --git a/packages/browser-wallet/src/popup/pages/AddWeb3IdCredential/AddWeb3IdCredential.tsx b/packages/browser-wallet/src/popup/pages/AddWeb3IdCredential/AddWeb3IdCredential.tsx index 59caea2d0..a33fe8ba0 100644 --- a/packages/browser-wallet/src/popup/pages/AddWeb3IdCredential/AddWeb3IdCredential.tsx +++ b/packages/browser-wallet/src/popup/pages/AddWeb3IdCredential/AddWeb3IdCredential.tsx @@ -6,6 +6,7 @@ import { useLocation } from 'react-router-dom'; import ExternalRequestLayout from '@popup/page-layouts/ExternalRequestLayout'; import Button from '@popup/shared/Button'; import { + sessionTemporaryVerifiableCredentialMetadataAtom, sessionTemporaryVerifiableCredentialsAtom, storedVerifiableCredentialMetadataAtom, storedVerifiableCredentialsAtom, @@ -51,6 +52,7 @@ export default function AddWeb3IdCredential({ onAllow, onReject }: Props) { const { onClose, withClose } = useContext(fullscreenPromptContext); const [acceptButtonDisabled, setAcceptButtonDisabled] = useState(false); const [web3IdCredentials, setWeb3IdCredentials] = useAtom(sessionTemporaryVerifiableCredentialsAtom); + const [tempMetdata, setTempMetadata] = useAtom(sessionTemporaryVerifiableCredentialMetadataAtom); const storedWeb3IdCredentials = useAtomValue(storedVerifiableCredentialsAtom); const [verifiableCredentialMetadata, setVerifiableCredentialMetadata] = useAtom( storedVerifiableCredentialMetadataAtom @@ -144,11 +146,12 @@ export default function AddWeb3IdCredential({ onAllow, onReject }: Props) { const credentialHolderId = wallet.getVerifiableCredentialPublicKey(issuer, index).toString('hex'); const credentialSubjectId = createPublicKeyIdentifier(credentialHolderId, network); const credentialSubject = { ...credential.credentialSubject, id: credentialSubjectId }; + const credentialId = createCredentialId(credentialHolderId, issuer, network); const fullCredential = { ...credential, credentialSubject, - id: createCredentialId(credentialHolderId, issuer, network), + id: credentialId, index, }; await setWeb3IdCredentials([...web3IdCredentials.value, fullCredential]); @@ -156,6 +159,7 @@ export default function AddWeb3IdCredential({ onAllow, onReject }: Props) { const newMetadata = { ...verifiableCredentialMetadata.value }; newMetadata[metadataUrl.url] = metadata; await setVerifiableCredentialMetadata(newMetadata); + await setTempMetadata({ ...tempMetdata.value, [credentialId]: metadata }); } return credentialSubjectId; } diff --git a/packages/browser-wallet/src/popup/pages/VerifiableCredential/VerifiableCredentialHooks.tsx b/packages/browser-wallet/src/popup/pages/VerifiableCredential/VerifiableCredentialHooks.tsx index d18227779..2bcf6d9e9 100644 --- a/packages/browser-wallet/src/popup/pages/VerifiableCredential/VerifiableCredentialHooks.tsx +++ b/packages/browser-wallet/src/popup/pages/VerifiableCredential/VerifiableCredentialHooks.tsx @@ -17,10 +17,12 @@ import { useEffect, useState } from 'react'; import { storedVerifiableCredentialMetadataAtom, storedVerifiableCredentialSchemasAtom, + sessionTemporaryVerifiableCredentialMetadataAtom, } from '@popup/store/verifiable-credential'; import { AsyncWrapper } from '@popup/store/utils'; import { ConcordiumGRPCClient } from '@concordium/web-sdk'; import { useTranslation } from 'react-i18next'; +import { noOp } from 'wallet-common-helpers'; /** * Retrieve the on-chain credential status for a verifiable credential in a CIS-4 credential registry contract. @@ -77,9 +79,11 @@ export function useCredentialEntry(credential?: VerifiableCredential) { if (credential) { const credentialHolderId = getCredentialHolderId(credential.id); const registryContractAddress = getCredentialRegistryContractAddress(credential.id); - getVerifiableCredentialEntry(client, registryContractAddress, credentialHolderId).then((entry) => { - setCredentialEntry(entry); - }); + getVerifiableCredentialEntry(client, registryContractAddress, credentialHolderId) + .then((entry) => { + setCredentialEntry(entry); + }) + .catch(noOp); // TODO add logging on catch? } }, [credential?.id, client]); @@ -97,6 +101,7 @@ export function useCredentialMetadata(credential?: VerifiableCredential) { const [metadata, setMetadata] = useState(); const credentialEntry = useCredentialEntry(credential); const storedMetadata = useAtomValue(storedVerifiableCredentialMetadataAtom); + const tempMetadata = useAtomValue(sessionTemporaryVerifiableCredentialMetadataAtom); useEffect(() => { if (!storedMetadata.loading && credentialEntry) { @@ -107,8 +112,14 @@ export function useCredentialMetadata(credential?: VerifiableCredential) { ); } setMetadata(storedCredentialMetadata); + } else if (!storedMetadata.loading && !credentialEntry && !tempMetadata.loading && credential) { + // Use temporary metadata + const tMetadata = tempMetadata.value[credential.id]; + if (tMetadata) { + setMetadata(tMetadata); + } } - }, [storedMetadata, credentialEntry]); + }, [storedMetadata.loading, tempMetadata.loading, credentialEntry, credential?.id]); return metadata; } diff --git a/packages/browser-wallet/src/popup/store/utils.ts b/packages/browser-wallet/src/popup/store/utils.ts index 897239e1e..d7ccb758a 100644 --- a/packages/browser-wallet/src/popup/store/utils.ts +++ b/packages/browser-wallet/src/popup/store/utils.ts @@ -31,6 +31,7 @@ import { storedAllowlist, storedVerifiableCredentialMetadata, sessionVerifiableCredentials, + sessionVerifiableCredentialMetadata, } from '@shared/storage/access'; import { ChromeStorageKey } from '@shared/storage/types'; import { atom, PrimitiveAtom, WritableAtom } from 'jotai'; @@ -66,6 +67,10 @@ const accessorMap: Record> = { [ChromeStorageKey.VerifiableCredentialMetadata]: storedVerifiableCredentialMetadata, [ChromeStorageKey.Allowlist]: storedAllowlist, [ChromeStorageKey.TemporaryVerifiableCredentials]: useIndexedStorage(sessionVerifiableCredentials, getGenesisHash), + [ChromeStorageKey.TemporaryVerifiableCredentialMetadata]: useIndexedStorage( + sessionVerifiableCredentialMetadata, + getGenesisHash + ), }; export function resetOnUnmountAtom(initial: V): PrimitiveAtom { diff --git a/packages/browser-wallet/src/popup/store/verifiable-credential.ts b/packages/browser-wallet/src/popup/store/verifiable-credential.ts index 134b30dc0..06de4d5fd 100644 --- a/packages/browser-wallet/src/popup/store/verifiable-credential.ts +++ b/packages/browser-wallet/src/popup/store/verifiable-credential.ts @@ -21,3 +21,7 @@ export const storedVerifiableCredentialMetadataAtom = atomWithChromeStorage< export const sessionTemporaryVerifiableCredentialsAtom = atomWithChromeStorage< Omit[] >(ChromeStorageKey.TemporaryVerifiableCredentials, [], true); + +export const sessionTemporaryVerifiableCredentialMetadataAtom = atomWithChromeStorage< + Record +>(ChromeStorageKey.TemporaryVerifiableCredentialMetadata, {}, true); diff --git a/packages/browser-wallet/src/shared/storage/access.ts b/packages/browser-wallet/src/shared/storage/access.ts index 56cdd4d6f..6244d1457 100644 --- a/packages/browser-wallet/src/shared/storage/access.ts +++ b/packages/browser-wallet/src/shared/storage/access.ts @@ -230,3 +230,7 @@ export const sessionPendingTransactions = makeIndexedStorageAccessor( export const sessionVerifiableCredentials = makeSerializedAndIndexedStorageAccessor< Omit[] >('session', ChromeStorageKey.TemporaryVerifiableCredentials); + +export const sessionVerifiableCredentialMetadata = makeIndexedStorageAccessor< + Record +>('session', ChromeStorageKey.TemporaryVerifiableCredentialMetadata); diff --git a/packages/browser-wallet/src/shared/storage/types.ts b/packages/browser-wallet/src/shared/storage/types.ts index 9e00302e8..2587e82bb 100644 --- a/packages/browser-wallet/src/shared/storage/types.ts +++ b/packages/browser-wallet/src/shared/storage/types.ts @@ -30,6 +30,7 @@ export enum ChromeStorageKey { VerifiableCredentialSchemas = 'verifiableCredentialSchemas', VerifiableCredentialMetadata = 'verifiableCredentialMetadata', TemporaryVerifiableCredentials = 'tempVerifiableCredentials', + TemporaryVerifiableCredentialMetadata = 'tempVerifiableCredentialMetadata', Allowlist = 'allowlist', } diff --git a/packages/browser-wallet/src/shared/utils/verifiable-credential-helpers.ts b/packages/browser-wallet/src/shared/utils/verifiable-credential-helpers.ts index 74f3b02ba..b778d9052 100644 --- a/packages/browser-wallet/src/shared/utils/verifiable-credential-helpers.ts +++ b/packages/browser-wallet/src/shared/utils/verifiable-credential-helpers.ts @@ -809,13 +809,17 @@ export async function getCredentialMetadata( ) { const metadataUrls: MetadataUrl[] = []; for (const vc of credentials) { - const entry = await getVerifiableCredentialEntry( - client, - getCredentialRegistryContractAddress(vc.id), - getCredentialHolderId(vc.id) - ); - if (entry) { - metadataUrls.push(entry.credentialInfo.metadataUrl); + try { + const entry = await getVerifiableCredentialEntry( + client, + getCredentialRegistryContractAddress(vc.id), + getCredentialHolderId(vc.id) + ); + if (entry) { + metadataUrls.push(entry.credentialInfo.metadataUrl); + } + } catch (e) { + // If we fail, the credential most likely doesn't exist and we skip it } } From 67ed77f534498e73aa8d871c93097f2f994c2c1a Mon Sep 17 00:00:00 2001 From: Hjort Date: Thu, 24 Aug 2023 13:44:46 +0200 Subject: [PATCH 2/5] Save metadata url in session storage instead of metadata, for new verifiable credentials --- .../AddWeb3IdCredential.tsx | 6 +-- .../VerifiableCredentialHooks.tsx | 38 +++++++++++-------- .../browser-wallet/src/popup/store/utils.ts | 6 +-- .../src/popup/store/verifiable-credential.ts | 8 ++-- .../src/shared/storage/access.ts | 7 ++-- .../src/shared/storage/types.ts | 2 +- 6 files changed, 38 insertions(+), 29 deletions(-) diff --git a/packages/browser-wallet/src/popup/pages/AddWeb3IdCredential/AddWeb3IdCredential.tsx b/packages/browser-wallet/src/popup/pages/AddWeb3IdCredential/AddWeb3IdCredential.tsx index a33fe8ba0..20b331668 100644 --- a/packages/browser-wallet/src/popup/pages/AddWeb3IdCredential/AddWeb3IdCredential.tsx +++ b/packages/browser-wallet/src/popup/pages/AddWeb3IdCredential/AddWeb3IdCredential.tsx @@ -6,7 +6,7 @@ import { useLocation } from 'react-router-dom'; import ExternalRequestLayout from '@popup/page-layouts/ExternalRequestLayout'; import Button from '@popup/shared/Button'; import { - sessionTemporaryVerifiableCredentialMetadataAtom, + sessionTemporaryVerifiableCredentialMetadataUrlsAtom, sessionTemporaryVerifiableCredentialsAtom, storedVerifiableCredentialMetadataAtom, storedVerifiableCredentialsAtom, @@ -52,7 +52,7 @@ export default function AddWeb3IdCredential({ onAllow, onReject }: Props) { const { onClose, withClose } = useContext(fullscreenPromptContext); const [acceptButtonDisabled, setAcceptButtonDisabled] = useState(false); const [web3IdCredentials, setWeb3IdCredentials] = useAtom(sessionTemporaryVerifiableCredentialsAtom); - const [tempMetdata, setTempMetadata] = useAtom(sessionTemporaryVerifiableCredentialMetadataAtom); + const [metadataUrls, setMetadataUrls] = useAtom(sessionTemporaryVerifiableCredentialMetadataUrlsAtom); const storedWeb3IdCredentials = useAtomValue(storedVerifiableCredentialsAtom); const [verifiableCredentialMetadata, setVerifiableCredentialMetadata] = useAtom( storedVerifiableCredentialMetadataAtom @@ -159,7 +159,7 @@ export default function AddWeb3IdCredential({ onAllow, onReject }: Props) { const newMetadata = { ...verifiableCredentialMetadata.value }; newMetadata[metadataUrl.url] = metadata; await setVerifiableCredentialMetadata(newMetadata); - await setTempMetadata({ ...tempMetdata.value, [credentialId]: metadata }); + await setMetadataUrls({ ...metadataUrls.value, [credentialId]: metadataUrl.url }); } return credentialSubjectId; } diff --git a/packages/browser-wallet/src/popup/pages/VerifiableCredential/VerifiableCredentialHooks.tsx b/packages/browser-wallet/src/popup/pages/VerifiableCredential/VerifiableCredentialHooks.tsx index 2bcf6d9e9..c1143f9c0 100644 --- a/packages/browser-wallet/src/popup/pages/VerifiableCredential/VerifiableCredentialHooks.tsx +++ b/packages/browser-wallet/src/popup/pages/VerifiableCredential/VerifiableCredentialHooks.tsx @@ -17,7 +17,7 @@ import { useEffect, useState } from 'react'; import { storedVerifiableCredentialMetadataAtom, storedVerifiableCredentialSchemasAtom, - sessionTemporaryVerifiableCredentialMetadataAtom, + sessionTemporaryVerifiableCredentialMetadataUrlsAtom, } from '@popup/store/verifiable-credential'; import { AsyncWrapper } from '@popup/store/utils'; import { ConcordiumGRPCClient } from '@concordium/web-sdk'; @@ -101,24 +101,30 @@ export function useCredentialMetadata(credential?: VerifiableCredential) { const [metadata, setMetadata] = useState(); const credentialEntry = useCredentialEntry(credential); const storedMetadata = useAtomValue(storedVerifiableCredentialMetadataAtom); - const tempMetadata = useAtomValue(sessionTemporaryVerifiableCredentialMetadataAtom); + const tempMetadata = useAtomValue(sessionTemporaryVerifiableCredentialMetadataUrlsAtom); useEffect(() => { - if (!storedMetadata.loading && credentialEntry) { - const storedCredentialMetadata = storedMetadata.value[credentialEntry.credentialInfo.metadataUrl.url]; - if (!storedCredentialMetadata) { - throw new Error( - `Attempted to find credential metadata for credentialId: ${credentialEntry.credentialInfo.credentialHolderId} but none was found!` - ); - } - setMetadata(storedCredentialMetadata); - } else if (!storedMetadata.loading && !credentialEntry && !tempMetadata.loading && credential) { - // Use temporary metadata - const tMetadata = tempMetadata.value[credential.id]; - if (tMetadata) { - setMetadata(tMetadata); - } + if (storedMetadata.loading) { + return; + } + let url; + if (credentialEntry) { + url = credentialEntry.credentialInfo.metadataUrl.url; + } else if (!tempMetadata.loading && credential) { + url = tempMetadata.value[credential.id]; + } + if (!url) { + return; + } + const storedCredentialMetadata = storedMetadata.value[url]; + if (!storedCredentialMetadata) { + throw new Error( + `Attempted to find credential metadata for credentialId: ${ + credentialEntry?.credentialInfo.credentialHolderId || credential?.id + } but none was found!` + ); } + setMetadata(storedCredentialMetadata); }, [storedMetadata.loading, tempMetadata.loading, credentialEntry, credential?.id]); return metadata; diff --git a/packages/browser-wallet/src/popup/store/utils.ts b/packages/browser-wallet/src/popup/store/utils.ts index d7ccb758a..f221a632a 100644 --- a/packages/browser-wallet/src/popup/store/utils.ts +++ b/packages/browser-wallet/src/popup/store/utils.ts @@ -31,7 +31,7 @@ import { storedAllowlist, storedVerifiableCredentialMetadata, sessionVerifiableCredentials, - sessionVerifiableCredentialMetadata, + sessionVerifiableCredentialMetadataUrls, } from '@shared/storage/access'; import { ChromeStorageKey } from '@shared/storage/types'; import { atom, PrimitiveAtom, WritableAtom } from 'jotai'; @@ -67,8 +67,8 @@ const accessorMap: Record> = { [ChromeStorageKey.VerifiableCredentialMetadata]: storedVerifiableCredentialMetadata, [ChromeStorageKey.Allowlist]: storedAllowlist, [ChromeStorageKey.TemporaryVerifiableCredentials]: useIndexedStorage(sessionVerifiableCredentials, getGenesisHash), - [ChromeStorageKey.TemporaryVerifiableCredentialMetadata]: useIndexedStorage( - sessionVerifiableCredentialMetadata, + [ChromeStorageKey.TemporaryVerifiableCredentialMetadataUrls]: useIndexedStorage( + sessionVerifiableCredentialMetadataUrls, getGenesisHash ), }; diff --git a/packages/browser-wallet/src/popup/store/verifiable-credential.ts b/packages/browser-wallet/src/popup/store/verifiable-credential.ts index 06de4d5fd..93ab2278d 100644 --- a/packages/browser-wallet/src/popup/store/verifiable-credential.ts +++ b/packages/browser-wallet/src/popup/store/verifiable-credential.ts @@ -22,6 +22,8 @@ export const sessionTemporaryVerifiableCredentialsAtom = atomWithChromeStorage< Omit[] >(ChromeStorageKey.TemporaryVerifiableCredentials, [], true); -export const sessionTemporaryVerifiableCredentialMetadataAtom = atomWithChromeStorage< - Record ->(ChromeStorageKey.TemporaryVerifiableCredentialMetadata, {}, true); +export const sessionTemporaryVerifiableCredentialMetadataUrlsAtom = atomWithChromeStorage>( + ChromeStorageKey.TemporaryVerifiableCredentialMetadataUrls, + {}, + true +); diff --git a/packages/browser-wallet/src/shared/storage/access.ts b/packages/browser-wallet/src/shared/storage/access.ts index 6244d1457..c714f3d0a 100644 --- a/packages/browser-wallet/src/shared/storage/access.ts +++ b/packages/browser-wallet/src/shared/storage/access.ts @@ -231,6 +231,7 @@ export const sessionVerifiableCredentials = makeSerializedAndIndexedStorageAcces Omit[] >('session', ChromeStorageKey.TemporaryVerifiableCredentials); -export const sessionVerifiableCredentialMetadata = makeIndexedStorageAccessor< - Record ->('session', ChromeStorageKey.TemporaryVerifiableCredentialMetadata); +export const sessionVerifiableCredentialMetadataUrls = makeIndexedStorageAccessor>( + 'session', + ChromeStorageKey.TemporaryVerifiableCredentialMetadataUrls +); diff --git a/packages/browser-wallet/src/shared/storage/types.ts b/packages/browser-wallet/src/shared/storage/types.ts index 2587e82bb..4fb7756df 100644 --- a/packages/browser-wallet/src/shared/storage/types.ts +++ b/packages/browser-wallet/src/shared/storage/types.ts @@ -30,7 +30,7 @@ export enum ChromeStorageKey { VerifiableCredentialSchemas = 'verifiableCredentialSchemas', VerifiableCredentialMetadata = 'verifiableCredentialMetadata', TemporaryVerifiableCredentials = 'tempVerifiableCredentials', - TemporaryVerifiableCredentialMetadata = 'tempVerifiableCredentialMetadata', + TemporaryVerifiableCredentialMetadataUrls = 'tempVerifiableCredentialMetadata', Allowlist = 'allowlist', } From 58fe871edacda6b0a745093a386e2b9e9a0ac466 Mon Sep 17 00:00:00 2001 From: Hjort Date: Thu, 24 Aug 2023 14:22:56 +0200 Subject: [PATCH 3/5] VerifiableCredentialDetails now handles missing credentialEntry --- .../VerifiableCredentialDetails.tsx | 81 +++++++++++-------- 1 file changed, 46 insertions(+), 35 deletions(-) diff --git a/packages/browser-wallet/src/popup/pages/VerifiableCredential/VerifiableCredentialDetails.tsx b/packages/browser-wallet/src/popup/pages/VerifiableCredential/VerifiableCredentialDetails.tsx index 7c74de008..a54134e1a 100644 --- a/packages/browser-wallet/src/popup/pages/VerifiableCredential/VerifiableCredentialDetails.tsx +++ b/packages/browser-wallet/src/popup/pages/VerifiableCredential/VerifiableCredentialDetails.tsx @@ -76,6 +76,48 @@ function DisplayIssuerMetadata({ issuer }: { issuer: string }) { ); } +/** + * Component for displaying information from the credentialEntry, if the entry is available. + * @param credentialEntry the credentialEntry to display info from + */ + +function DisplayCredentialEntryInfo({ credentialEntry }: { credentialEntry?: CredentialQueryResponse }) { + const { t } = useTranslation('verifiableCredential'); + + if (!credentialEntry) { + return null; + } + + const validFrom = dateFromTimestamp(credentialEntry.credentialInfo.validFrom, TimeStampUnit.milliSeconds); + const validUntil = credentialEntry.credentialInfo.validUntil + ? dateFromTimestamp(credentialEntry.credentialInfo.validUntil, TimeStampUnit.milliSeconds) + : undefined; + const validFromFormatted = withDateAndTime(validFrom); + const validUntilFormatted = withDateAndTime(validUntil); + + return ( +
+ + + {credentialEntry.credentialInfo.validUntil !== undefined && ( + + )} +
+ ); +} + /** * Component for displaying the extra details about a verifiable credential, i.e. the * credential holder id, when it is valid from and, if available, when it is valid until. @@ -87,43 +129,16 @@ function VerifiableCredentialExtraDetails({ className, issuer, }: { - credentialEntry: CredentialQueryResponse; + credentialEntry?: CredentialQueryResponse; status: VerifiableCredentialStatus; metadata: VerifiableCredentialMetadata; issuer: string; } & ClassName) { - const { t } = useTranslation('verifiableCredential'); - - const validFrom = dateFromTimestamp(credentialEntry.credentialInfo.validFrom, TimeStampUnit.milliSeconds); - const validUntil = credentialEntry.credentialInfo.validUntil - ? dateFromTimestamp(credentialEntry.credentialInfo.validUntil, TimeStampUnit.milliSeconds) - : undefined; - const validFromFormatted = withDateAndTime(validFrom); - const validUntilFormatted = withDateAndTime(validUntil); - return (
-
- - - {credentialEntry.credentialInfo.validUntil !== undefined && ( - - )} -
+
@@ -198,10 +213,6 @@ export default function VerifiableCredentialDetails({ }, [client, credential, hdWallet, credentialEntry, nav, pathname]); const menuButton: MenuButton | undefined = useMemo(() => { - if (credentialEntry === undefined) { - return undefined; - } - const menuButtons = []; if (credentialEntry?.credentialInfo.holderRevocable && status !== VerifiableCredentialStatus.Revoked) { @@ -230,9 +241,9 @@ export default function VerifiableCredentialDetails({ return undefined; }, [credentialEntry?.credentialInfo.holderRevocable, goToConfirmPage, showExtraDetails]); - // Wait for the credential entry to be loaded from the chain, and for the HdWallet + // Wait for the HdWallet // to be loaded to be ready to derive keys. - if (credentialEntry === undefined || hdWallet === undefined) { + if (hdWallet === undefined) { return null; } From e7f19003cc15618fba68406775fe0f0d7cd75af2 Mon Sep 17 00:00:00 2001 From: Hjort Date: Thu, 24 Aug 2023 15:35:38 +0200 Subject: [PATCH 4/5] Bump version --- packages/browser-wallet/CHANGELOG.md | 2 +- packages/browser-wallet/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/browser-wallet/CHANGELOG.md b/packages/browser-wallet/CHANGELOG.md index b91d25f66..47bdd3c0c 100644 --- a/packages/browser-wallet/CHANGELOG.md +++ b/packages/browser-wallet/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 1.1.2 ### Added diff --git a/packages/browser-wallet/package.json b/packages/browser-wallet/package.json index 15292581e..ec1c0787e 100644 --- a/packages/browser-wallet/package.json +++ b/packages/browser-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@concordium/browser-wallet", - "version": "1.1.1", + "version": "1.1.2", "description": "Browser extension wallet for the Concordium blockchain", "author": "Concordium Software", "license": "Apache-2.0", From 6392ea9d546ebdaab1d4e3e6cc6d1b64771656f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Hjort?= <87635671+shjortConcordium@users.noreply.github.com> Date: Thu, 24 Aug 2023 15:59:45 +0200 Subject: [PATCH 5/5] Update packages/browser-wallet/src/shared/storage/types.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jakob Ørhøj <57264157+orhoj@users.noreply.github.com> --- packages/browser-wallet/src/shared/storage/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/browser-wallet/src/shared/storage/types.ts b/packages/browser-wallet/src/shared/storage/types.ts index 4fb7756df..f514c367c 100644 --- a/packages/browser-wallet/src/shared/storage/types.ts +++ b/packages/browser-wallet/src/shared/storage/types.ts @@ -30,7 +30,7 @@ export enum ChromeStorageKey { VerifiableCredentialSchemas = 'verifiableCredentialSchemas', VerifiableCredentialMetadata = 'verifiableCredentialMetadata', TemporaryVerifiableCredentials = 'tempVerifiableCredentials', - TemporaryVerifiableCredentialMetadataUrls = 'tempVerifiableCredentialMetadata', + TemporaryVerifiableCredentialMetadataUrls = 'tempVerifiableCredentialMetadataUrls', Allowlist = 'allowlist', }