From 7e1beb8dca87b11b620b7db24838d7c04fdb8bd1 Mon Sep 17 00:00:00 2001 From: "Jason C. Leach" Date: Wed, 20 Dec 2023 17:04:04 -0800 Subject: [PATCH] fix: unlock with bizcd (#1686) Signed-off-by: Jason C. Leach --- app/src/components/AddCredentialSlider.tsx | 4 ++-- app/src/helpers/BCIDHelper.ts | 8 +++++--- app/src/hooks/notifications.ts | 1 - 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/components/AddCredentialSlider.tsx b/app/src/components/AddCredentialSlider.tsx index 6b6504fc..d7be2f35 100644 --- a/app/src/components/AddCredentialSlider.tsx +++ b/app/src/components/AddCredentialSlider.tsx @@ -10,7 +10,7 @@ import Icon from 'react-native-vector-icons/MaterialCommunityIcons' import { hitSlop } from '../constants' import { BCWalletEventTypes } from '../events/eventTypes' -import { showBCIDSelector } from '../helpers/BCIDHelper' +import { showPersonCredentialSelector } from '../helpers/BCIDHelper' export default function AddCredentialSlider() { const { ColorPallet, TextTheme } = useTheme() @@ -91,7 +91,7 @@ export default function AddCredentialSlider() { (c) => c.metadata.data[AnonCredsCredentialMetadataKey].credentialDefinitionId as string ) - setShowGetFoundationCredential(showBCIDSelector(credentialDefinitionIDs, true)) + setShowGetFoundationCredential(showPersonCredentialSelector(credentialDefinitionIDs)) }, [credentials]) useEffect(() => { diff --git a/app/src/helpers/BCIDHelper.ts b/app/src/helpers/BCIDHelper.ts index 29625075..321ac97c 100644 --- a/app/src/helpers/BCIDHelper.ts +++ b/app/src/helpers/BCIDHelper.ts @@ -41,7 +41,10 @@ export interface WellKnownAgentDetails { invitationId?: string } -export const showPersonCredentialSelector = (credentialDefinitionIDs: string[], canUseLSBCredential: boolean = true): boolean => { +export const showPersonCredentialSelector = ( + credentialDefinitionIDs: string[], + canUseLSBCredential: boolean = true +): boolean => { // If we already have a trusted foundation credential do nothing. if (credentialDefinitionIDs.some((i) => trustedFoundationCredentialIssuerRe.test(i))) { return false @@ -51,8 +54,7 @@ export const showPersonCredentialSelector = (credentialDefinitionIDs: string[], const unlockedByTrustedIssuer = credentialDefinitionIDs.some((i) => trustedInvitationIssuerRe.test(i)) || credentialDefinitionIDs.some((i) => trustedBusinessCardCredentialIssuerRe.test(i)) || - (credentialDefinitionIDs.some((i) => trustedLSBCCredentialIssuerRe.test(i)) && canUseLSBCredential) - + (credentialDefinitionIDs.some((i) => trustedLSBCCredentialIssuerRe.test(i)) && canUseLSBCredential) // We have a trusted credential and can use the LSB credential if (unlockedByTrustedIssuer) { diff --git a/app/src/hooks/notifications.ts b/app/src/hooks/notifications.ts index 9ca2178e..aed54cf0 100644 --- a/app/src/hooks/notifications.ts +++ b/app/src/hooks/notifications.ts @@ -73,7 +73,6 @@ export const useNotifications = (): Notifications => { (c) => c.metadata.data[AnonCredsCredentialMetadataKey].credentialDefinitionId as string ) const invitationDate = getUnlockCredentialDate(credentials) - console.log('invitationDate', invitationDate) const custom: CustomNotification[] = showPersonCredentialSelector(credentialDefinitionIDs) && invitationDate &&